Setup Linode Ubuntu LAMP Server
Here are my notes to setup a Linode LAMP Server from scratch using Ubuntu 10.04 LTS / Apache2:
SSH to your server
ssh root@IP
Update Ubuntu
sudo apt-get update
Achtung! Do not install Apache/MySQL/PHP before hostname is set exactly the way you want it.
hostname --fqd
Will display FQDN (Fully Qualified Domain Name)
echo "slice1" > /etc/hostname
hostname slice1
Edit hosts file on the Linode server (not the one on your local machine)
sudo vi /etc/hosts
add “IP” “slice1.someuncommonname.com” “slice1″
check if hostname is set correctly
hostname
output should be “slice1″
hostname -f
output should be “slice1.someuncommonname.com”
Set timezone
sudo dpkg-reconfigure tzdata
Setup Networking
http://library.linode.com/networking/configuring-static-ip-interfaces
add this line to end of resolv.conf
sudo vi /etc/resolv.conf
“options rotate”
add your IP – Netmask – Gateway
sudo vi /etc/network/interfaces
sudo /etc/init.d/networking restart
ping the Gateway
ping IP
Remove DHCP if exits
sudo apt-get remove isc-dhcp-client dhcp3-client dhcpcd
http://library.linode.com/lamp-guides/ubuntu-10.04-lucid
Install Apache
sudo apt-get install apache2 sudo vi /etc/apache2/sites-available/www.example.com
copy this code into the file
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName www.example.com
ServerAlias www.example.com
DocumentRoot /var/www/www.example.com/
</VirtualHost>
sudo vi /var/www/www.example.com/index.html
enter some text “it lives”
a2ensite www.example.com sudo vi /etc/apache2/sites-available/default
change AllowOverride None > AllowOverride All
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
Enable Apache rewrite module and restart
sudo a2enmod rewrite sudo /etc/init.d/apache2 restart
Install MYSQL Server
sudo apt-get install mysql-server
Harden MYSQL
sudo mysql_secure_installation
answer Yes to all questions (but no need to change password)
Install PHP
sudo apt-get install php5 php-pear
Tune the PHP configuration file
sudo vi /etc/php5/apache2/php.ini
uncomment this code or update setting
max_execution_time = 30 memory_limit = 64M (this was set to 128M in my config) error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (had to change this one) display_errors = Off log_errors = On error_log = /var/log/php.log (this was the only item disabled in my config) register_globals = Off
sudo /etc/init.d/apache2 restart sudo apt-get install php5-mysql
Harden PHP
sudo apt-get install php5-suhosin sudo /etc/init.d/apache2 restart
If there are no errors on Apache Restart, you’re good to go.
Enable Pre-Login Message
sudo vi /etc/ssh/sshd_config
uncommment
Banner /etc/issue.net
sudo vi /etc/issue.net
enter your warning message
————-
W A R N I N G
————-
THIS IS A PRIVATE COMPUTER SYSTEM.
This computer system including all related equipment, network devices (specifically
including Internet access), are provided only for authorized use. All computer systems
may be monitored for all lawful purposes, including to ensure that their use is
authorized, for management of the system, to facilitate protection against unauthorized
access, and to verify security procedures, survivability and operational security.
Monitoring includes active attacks by authorized personnel and their entities to test or
verify the security of the system. During monitoring, information may be examined,
recorded, copied and used for authorized purposes. All information including personal
information, placed on or sent over this system may be monitored. Uses of this system,
authorized or unauthorized, constitutes consent to monitoring of this system.
Unauthorized use may subject you to criminal prosecution. Evidence of any such
unauthorized use collected during monitoring may be used for administrative, criminal or
other adverse action. Use of this system constitutes consent to monitoring for these
purposes.
I can highly recommend Linode installations. Easy, fully functional, optimized, ready to go, LAMP stack.
