Easy step by step guide to setup your Linode Centos 5.3 server (via SSH without cpanel). We will show you how to install the LAMP stack (Apache, MySQL, PHP) and Wordpress.
Linode as well as most VPS (Virtual Private Servers), generally come with the minimum install of Linux by default, so to get to a full Wordpress blog running, you need a bit of work. This how-to will get you done very quickly.
First action: Update the box with a simple yum upgrade:
# yum upgrade
Say “yes” to all the questions to get everything updated before we move on.
1-Install Apache, PHP and the MySQL Server:
# yum install httpd.i386 php.i386 mysql.i386 php-mysql.i386 mysql-server.i386
After that is done, we can start Apache and configure it to start during the boot:
# chkconfig –level 3 httpd on
# /etc/init.d/httpd start
Starting httpd: [ OK ]
You should now see Apache running with the “netstat” command:
#netstat -tanep |grep LISTEN
tcp 0 0 :::80 :::* LISTEN 0 21928 3098/httpd
tcp 0 0 :::22 :::* LISTEN 0 20513 3030/sshd
Very simple and easy.
2-Configure MySQL
Before we start MySQL we need to secure and tune it a little bit. MySQL comes with the “mysql_secure_installation” command to help automate this work. To get started, run:
[root@li65-185 ~]# /usr/bin/mysql_secure_installation
And say yes to all the questions:( and remember the MySQL root password since you will need it later)
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
After that, you can start MySQL, configure it to start during boot and check if it is running with the “netstat” command:
# /etc/init.d/mysqld start
# chkconfig –level 3 mysqld on
# netstat -tanep
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 27 22517 3246/mysqld
If you see the “mysqld” command on port 3306 it means you are all set to go.
3-Setting up database for Wordpress:
Once you have MySQL and Apache running, we can create the necessary tables in the database for Wordpress. These three queries are enough for it (you just need to change wpsite1 for the database name you want and wpuser/wppass for the username/password combination you prefer)
# mysql -u root -e “CREATE DATABASE wpsite1″ -p
# mysql -u root -e ‘GRANT ALL PRIVILEGES ON wpsite1.* TO “wpuser”@”localhost” IDENTIFIED BY “wppass”;’ -p
# mysql -u root -e ‘FLUSH PRIVILEGES;’ -p
Note that it will ask for your MySQL password you gave when you ran the “mysql_secure_installation” command. I hope you kept it in memory.
4- Installing Wordpress
Wordpress is very easy to install and widely documented. You just need to download it to your htdocs directory (in our case /var/www), uncompress and rename it to your site name (for this example we will use “yoursite.name”):
# cd /var/www
# wget http://wordpress.org/latest.tar.gz
# tar -zxvf latest.tar.gz
# mv wordpress yoursite.name
# cd /var/www/yoursite.name
Now, you need to rename wp-config-sample.php to wp-config.php and edit it with the
database name, user and pass you specified before:
# mv wp-config-sample.php wp-config.php
# vim wp-config.php
define(‘DB_NAME’, ‘wpfseek’);
define(‘DB_USER’, ‘wpfseeku’);
define(‘DB_PASSWORD’, ‘wpfseekp’);
Now that wordpress is done you need to configure apache to read /var/www/yoursite.name as the main root
for your site. To do that, create a file at /etc/httpd/conf.d like that (remember, always change yoursite.name for your real domain and 1.2.3.4 for your IP address):
# cat > /etc/httpd/conf.d
NameVirtualHost 1.2.3.4:80
<VirtualHost 1.2.3.4:80>
DocumentRoot “/var/www/yoursite.name”
ServerName yoursite.name
ErrorLog logs/error.log
CustomLog logs/access.log combined
<Directory “/var/www/yoursite.name”>
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Restart Apache and now you should be able to access your site to start blogging:
/etc/init.d/httpd restart
All commands to get the server ready for MySQL:
yum install httpd.i386 php.i386 mysql.i386 php-mysql.i386 mysql-server.i386
chkconfig –level 3 httpd on
chkconfig –level 3 mysqld on
/usr/bin/mysql_secure_installation
/etc/init.d/httpd start
/etc/init.d/mysqld start