Setting Up Your Ubuntu 8.10 VPS with VPS Ville Pt. 1 LAMP

Wednesday, February 25, 2009 15:31
Posted in category Big Pimping, Ubuntu, VPS

Based on a request I’m going to take you guys through setting up your own VPS for AM / IM work.  This includes setting up LAMP (Linux, Apache, MySQL, PHP).  We are going to be working with Ubuntu Linux 8.10, as it’s a fairly easy, secure setup.

Make sure you select Ubuntu 8.10 Minimal for installation.

In order to log into your VPS your going to need an SSH client.  Us who already run Linux can just use the SSH command from the command line / terminal.  Others, like Windblows users will have to get and SSH client.  I’d recommend PuTTY.

For the sake of time and propagation, I’d point a domain to the VPS Ville DNS.

1.  Logging into your VPS

You’ll get an e-mail from the host with a root password and your vps’s IP address.  Linux users can log in with the command:

ssh root@ipaddress

Others using a client should be something similar, minus the ssh.  I don’t have a client in front of me though so I can’t say.

You’ll see a prompt:

root@vpsipaddress’s password:

Enter your password and press enter.

2. Repositories

With this OS footprint installed we get to same some time, we don’t have to install SSH, our host files are set correctly already.  So we just get to move into the fun stuff.  Let’s get our repositories in line.  You download all your files from the repositories so it’s important you have all the important ones included.  VPS Ville gives you a slimmed down list, not that there’s anything wrong with that, I just prefer to have EVERYTHING open so I’m not fumbling around later if I need some package.

Your also going to have to get comfortable using nanonano is a UNIX file editor.  There are other editors out there, for example vi, but I think nano is easiest to use.  Lets open our repository (source) list:

nano /etc/apt/sources.list

Make your list look like this:

deb http://de.archive.ubuntu.com/ubuntu/ intrepid main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ intrepid main restricted

deb http://de.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted

deb http://de.archive.ubuntu.com/ubuntu/ intrepid universe
deb-src http://de.archive.ubuntu.com/ubuntu/ intrepid universe
deb http://de.archive.ubuntu.com/ubuntu/ intrepid-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ intrepid-updates universe

deb http://de.archive.ubuntu.com/ubuntu/ intrepid multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ intrepid multiverse
deb http://de.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse

deb http://security.ubuntu.com/ubuntu intrepid-security main restricted
deb-src http://security.ubuntu.com/ubuntu intrepid-security main restricted
deb http://security.ubuntu.com/ubuntu intrepid-security universe
deb-src http://security.ubuntu.com/ubuntu intrepid-security universe
deb http://security.ubuntu.com/ubuntu intrepid-security multiverse
deb-src http://security.ubuntu.com/ubuntu intrepid-security multiverse

To save press Ctrl + O, then Enter to save.  Then Ctrl + X to exit.

Now we have to update our package list:

apt-get update

Install any upgrades that may have come down:

apt-get upgrade

Finally reboot your server.  You can do this fromt he VPS Ville Control Panel or simply by typing:

reboot

3. Disable AppArmour

From my understanding you don’t really need AppArmour, and it can cause many headaches.  So let’s get rid of it.  Note:  There all separate commands.

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils

4. Install Initial Software

Stuff we need to get other stuff done right now.  Note: This is all one command!

apt-get -y install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ build-essential

5. Apache/PHP5/Ruby/Python

Lets get our web-server up and running, whatever language you want!

First we install Apache:

apt-get -y install apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2-suexec libexpat1 ssl-cert

Then PHP, Ruby, and Python as Apache modules.  Note: It’s all one command!

apt-get -y install libapache2-mod-php5 libapache2-mod-ruby libapache2-mod-python php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Double check your DirectoryIndex file:

nano /etc/apache2/mods-available/dir.conf

Looks like:

<IfModule mod_dir.c>

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

</IfModule>

Next we have to enable a few Apache modules that we’ll need.  Note: All separate commands!

a2enmod ssl
a2enmod rewrite
a2enmod suexec
a2enmod include

Now restart Apache:

/etc/init.d/apache2 restart

Type your VPS’s IP address into your browser, you should say:

It works!

Now lets test PHP5, first we create a simple file:

nano /var/www/phpinfo.php

Put this in the file:

<?php phpinfo(); ?>

Press Ctrl + O, then Enter to save.  Then Ctrl + X to exit.

Now navigate your browser to http://yourvpsip/phpinfo.php and you should have see your server configurations.  PHP is successfully installed!

6. MySQL

Let’s get our database on!  Note: All one command!

apt-get -y install mysql-server mysql-client libmysqlclient15-dev

There will be two promps, or two screens that will ask you for a root password.  Don’t forget this password!

Now we need to check that MySQL is bound to our loopback address 127.0.0.1 instead of just localhost.  My setup already was, yours may also.

nano /etc/mysql/my.cnf

Find the section of the file that looks like this, and make it look like this if it doesn’t already:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

Restart MySQL if you made changes:

/etc/init.d/mysql restart

Check to see if MySQL is running:

netstat -tap | grep mysql

It should look something like this:

tcp        0      0 localhost.localdo:mysql *:*                     LISTEN      8148/mysqld

MySQL is running Success!

7.  phpMyAdmin

Now lets get ourselfs an interface that we can use for MySQL:

apt-get -y install phpmyadmin

It might ask you what server to configure for, obviously choose apache2.

Now it wont work right out the box, we need to add a line to our Apache configuration:

nano /etc/apache2/apache2.conf

Go to the end of the file and add this line:

Include /etc/phpmyadmin/apache.conf

Ctrl + O, then Enter to save.  Ctrl + X to exit.  Now restart Apache:

/etc/init.d/apache2 restart

Hopefully now that domain name you added the the VPS Ville DNS has switched over and you can use that now.  Try http://domainname.tld/phpmyadmin, your can also try http://vspipaddress/phpmyadmin.  You should get the phpMyAdmin login screen, Username is root and password is what you set during the MySQL installation.

Viola!

End Part 1.

This ends the first part of the journey of setting up your own Ubuntu Linux VPS.  At this point we have a workable server environment but we are still missing many peices.  We don’t have an FTP server.  We don’t have a mail server.  We are stilling running in root, which is a security no no in Ubuntu.  Those will be covered tomorrow.   There’s still a bit after that so stay tuned!

You can leave a response, or trackback from your own site.
Hotmail


Leave a Reply