Step One - Install Apache: Sudo Apt-Get Update
Step One - Install Apache: Sudo Apt-Get Update
Apache is a free open source software which runs over 50% of the worlds web servers.
To install apache, open terminal and type in these commands:
sudo apt-get update
sudo apt-get install apache2
Thats it. To check if Apache is installed, direct your browser to your servers IP address
(eg. http://12.34.56.789). The page should display the words It works!" like this.
During the installation, MySQL will ask you to set a root password. If you miss the
chance to set the password while the program is installing, it is very easy to set the
password later from within the MySQL shell.
Once you have installed MySQL, we should activate it with this command:
sudo mysql_install_db
The prompt will ask you for your current root password.
Type it in.
Enter current password for root (enter for none):
Then the prompt will ask you if you want to change the root password.
Go ahead and choose N and move on to the next steps.
Its easiest just to say Yes to all the options. At the end, MySQL will reload and
implement the new changes.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.
go a bit smoother.
production environment.
This
ensures that someone cannot guess at the root password from the network.
By default, MySQL comes with a database named 'test' that anyone can
access.
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
... Success!
Cleaning up...
Once you're done with that you can finish up by installing PHP.
After you answer yes to the prompt twice, PHP will install itself.
It may also be useful to add php to the directory index, to serve the relevant php index
files:
sudo nano /etc/apache2/mods-enabled/dir.conf
Add index.php to the beginning of index files. The page should now look like this:
<IfModule mod_dir.c>
</IfModule>
PHP Modules
PHP also has a variety of useful libraries and modules that you can add onto your
virtual server. You can see the libraries that are available.
apt-cache search php5-
Terminal will then display the list of possible modules. The beginning looks like this:
php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language
php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dbg - Debug symbols for PHP5
php5-dev - Files for PHP5 module development
php5-gd - GD module for php5
php5-gmp - GMP module for php5
php5-ldap - LDAP module for php5
php5-mysql - MySQL module for php5
php5-odbc - ODBC module for php5
php5-pgsql - PostgreSQL module for php5
php5-pspell - pspell module for php5
php5-recode - recode module for php5
php5-snmp - SNMP module for php5
You can install multiple libraries at once by separating the name of each module with a
space.
Congratulations! You now have LAMP stack on your droplet!
?>
Finish up by visiting your php info page (make sure you replace the example ip address
with your correct one): http://12.34.56.789/info.php
This will ask you a few questions in order to configure your installation correctly.
For the server selection, choose apache2. Note: If you do not hit "SPACE" to select
Apache, the installer will not move the necessary files during installation. Hit "SPACE",
"TAB", and then "ENTER" to select Apache.
Select yes when asked whether to use dbconfig-common to set up the database
The installation process actually adds the phpMyAdmin Apache configuration file into
the/etc/apache2/conf-enabled/ directory, where it is automatically read.
The only thing we need to do is explicitly enable the php5-mcrypt extension, which we
can do by typing:
You can now access the web interface by visiting your server's domain name or public
IP address followed by /phpmyadmin:
http://domain_name_or_IP/phpmyadmin