Glad you could stop by the Linux Basement site. Linux Basement is an informational Podcast about Linux, open source software and lots of other wonderful technology. If you want to find out more about open source technologies, subscribe and have a listen!

#linuxbasement is up at irc.freenode.net

MP3 Feed
Ogg Vorbis Feed
MP3 Feed (all episodes)
Ogg Feed (all episodes)

 

Installing Hardy Server - Part II - Getting Web Ready

Now it is time to log into your server. Remember that you have to log in with the username/password that you created durring the installation process.



For our purposes, we need to configure root access. To do this, you must issue the root user a password.

sudo passwd root

You will notice that you are first promted for your password, and then prompted twice to enter a password for root. Now that you have a password, you can change into root by typing:

sudo -i



To configure your server properly for your environment, it is often best that a web server has a static IP. To change the IP of your server, do the following at the command line with your text editor of choice. In my case, I will use nano:

nano /etc/network/interfaces



Here we see the network configuration of your virtual linux server. lo is the loopback interface, which should not be changed. Below that is eth0, which on most systems will be the primary ethernet interface. Lets go ahead and change this from DHCP to a static IP. When you are done, it should look something like this at the end of your file:

# The primary network interface

auto eth0

iface eth0 inet static

        address 10.1.13.13

        netmask 255.0.0.0

        gateway 10.1.1.1



Hit ctr-x to save the file. These network variables will be different on your network, and should be changed accordingly. To restart the network interface, do the following (warning: if you are ssh'd into the server, this will disconnect you!):

/etc/init.d/networking restart



You should also modify the hosts file to fit your environment. To edit it, do the following:

nano /etc/hosts



It is good practice to add your static IP address here and modify your hostname accordingly. So the file should look like this at the top:

127.0.0.1        localhost

127.0.1.1        eschool.yourdomain.local        eschool

10.1.13.13        eschool.yourdomain.local        eschool

Before you SSH into your server, it is good practice to change the default port for SSH. This is a common security practice to avoid bots on the web that look for open port 22. To change the port for SSH on your server, do the following:

nano /etc/ssh/sshd_config



At the very top of the file, 5 lines down you will see the Port 22 configuration. Simply change that number to an appropriate port that you will remember. I like to change it to my birth year so that I will remember it. Also keep in mind by changing this port, you will need to configure your firewall appropriatly, if you need to access the server via SSH from outside your network. You could conversly not change the SSH port from 22, but rather use port forwarding on your firewall to forward from a different port, to port 22 on the server. This configuration is beyond the scope of this document.



Now that your server has a static IP, it should be safe to SSH into it to do further configuration. The most popular SSH client is PUTTY, which is free. If you have changed your default SSH port, make sure to change it on PUTTY also, when you SSH in.



Because Ubuntu Hardy Heron comes with a new application firewall, we need to disable it, so that it does not get in the way of our web server. Do the following:

/etc/init.d/apparmor stop

update-rc.d -f apparmor remove



Now we are ready to install our LAMP (Linux Apache MySQL PHP) stack. Do the following:

apt-get install mysql-server mysql-client libmysqlclient15-dev apache2 apache2-doc php5 php5-common php5-curl php5-dev php5-gd

Once the packages are done downloading they will begin to install. MySQL will ask you for an administrative password.



This is important, as you will need to know it to administer MySQL. Enter the password twice and the installation should continue.



The beauty of Debian based linux. Apt will go out, get the packages, and install them for you. In a few minutes, you will have a web server.



To give the server the capability of sending emails and web administration of MySQL, we will install the following

apt-get install postfix

Durring the installation you will be promted to choose the type of mail configuration. You should choose Internet Site, which is the default choice.

Then, you will need to put your fully qualified domain name in. This can be reconfigured later if need be.

When the install is complete, we will need to make a slight config change in our php.ini file to allow mail to be sent via PHP5. To do this, open /etc/php5/apache2/php.ini in a text editor. I will use nano and change the senmail line to this:

sendmail_path = "/usr/sbin/sendmail -t -i"

Make sure to restart your webserver for these changes to take affect.

/etc/init.d/apache2 restart



Now lets install phpmyadmin so that we have a graphical user interface for administration of MySQL. To install, simply do:



apt-get install phpmyadmin



Durring the installation you will be prompted to select your type of install. You have to hit the spacebar to mark "apache2" as your installation type. If you do not do this, you will have problems accessing your installation of phpmyadmin.

 

Once phpmyadmin is installed, you should be able to access it through a browser using http://<your server IP>/phpmyadmin or http://<servername>/phpmyadmin. To log into phpmyadmin, you will need to MySQL root password you provided when you installed MySQL earlier.

Next time, we will do a few more things to prepare for Drupal 6, and get it installed!