VPS LAMP stackscript additional settings to make it work

If you have some stackscript, like you might have on VPS like Linode, where you have automaticly installed some linux distribution like Debian, and then Apacher, PHP and MySQL are also installed, this will not work out of the box, you will still need to add some extra stuff on your VPS so you could install some drupal sites.

1. You should enter following commands to set the hostname, replacing duck with the hostname of your choice:

echo "duck" > /etc/hostname
hostname -F /etc/hostname

2. Edit your /etc/hosts file to resemble the following example, replacing duck with your chosen hostname, example.com with your system's domain name, and 32.14.56.18 with your system's IP address (you can leave example.com as it is)

127.0.0.1        localhost.localdomain    localhost
32.14.56.18      duck.example.com         duck

3. Run dpkg-reconfigure tzdata to set your timezone, this is autoconfig with options

4. Run mysql_secure_installation to finish off your mysql installation

5. Run apt-get upgrade --show-upgraded to have all your packages updated

6. Install stuff like gd library, memcache, pear, phpmyadmin etc you do it like

apt-get install php5 php-pear php5-suhosin

7. Enabled apache modes you need, like you run this for url rewrites

a2enmod rewrite

8. Create your virtual host files in /etc/apache2/sites-available/example.com
Like

<VirtualHost *:80>
     ServerAdmin webmaster@example.com
     ServerName example.com
     ServerAlias www.example.com
     DocumentRoot /srv/www/example.com/public_html/
     ErrorLog /srv/www/example.com/logs/error.log
     CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>

Make appropriate directories so that site would work, otherwise you whole server won't work if these are missing and you enabled site, or you enable it and then delete them

mkdir -p /srv/www/example.com/public_html
mkdir /srv/www/example.com/logs

and then run a2ensite example.com if some problems occur you dissable site with a2dissite example.com

9. You should also make some database, lets make one quickly and add user so we can instal some site.

Login to mysql with your root user mysql -u root -p enter password and then
enter lines with semicolon included

create database hiphop;
grant all on hiphop.* to 'baker' identified by 'fre8';
quit

10. In the end to kind of Refresh all of this, run /etc/init.d/apache2 restart
or /etc/init.d/apache2 reload (you can also run it between some steps, sometimes even apache will recommend this with prompt message) and it should work fine.