Setting up my new wordpress server with gory detail

29 Mar

I got a new desktop in the fall and my old desktop was going to get used for a media center PC. But I have been getting a lot of errors on my 10+ year old desktop that I call a server so it was time for a server upgrade.

download bit torrent

download ubuntu 10.10 amd64 iso.torrent

use windows cd image burner to make ubuntu boot cd

reboot computer and hit f10, switch raid from stripe to mirror

install ubuntu

detect keyboard layout
select detroit time zone
select the raid drive and create empty partition/ automatically partition with swap drive
installs base system
Select a good hostname in case I need a second server
don’t pick any prepared software (apt-get later)

And linux is setup… login…

install a text editor
sudo apt-get nano
sudo nano /etc/network/interfaces
#set static ip by changing the file and adding this to the end
iface eth0 inet static

sudo /etc/init.d/networking restart

sudo apt-get install mysql-server
->set passowrd
sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo apt-get openssh-server

sudo groupadd sftponly
sudo useradd -d /home/testuser -m testuser
sudo passwd testuser
sudo adduser testuser sftponly

—->edit the ssh config
sudo nano /etc/ssh/sshd_config

Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp

—–>Some users can only use sftp, but not other OpenSSH features like remote login. Let’s create a rule for that group of users (we’ll create the group afterwards). Add the following section to the bottom of /etc/ssh/sshd_config:
Match group sftponly
ChrootDirectory /home/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

—>Pass ownership of test users directory you want to be sftp accessible to the superuser:
sudo chown root.root /home/testuser
sudo usermod -d / testuser

sudo apt-get phpmyadmin
sudo apt-get wordpress

—>create a database and a user that has full privileges to that db

—->create a pointer for the wordpress www dir to the actual dir
sudo ln -s /usr/share/wordpress /var/www/wordpress

move config sample to wp-config.php and change these
define(‘DB_NAME’, ‘wordpress’);
define(‘DB_USER’, ‘wordpress’);
define(‘DB_PASSWORD’, ‘wordpresspassword’);
define(‘DB_HOST’, ‘localhost’);

—>>OK the new blog works now, lets pull the ole switcheroo

download the old blog wordpress directory
create a sql backup file using “Export” in the old wordpress phpmyadmin

create a new sql database on the new server for wordpress
create a user

use the import and select the sql file

copy the wp-config-sample.php to wp-config.php and locally edit with the new db values

setup a sftp user with write access, chown some directories
upload the new files and create a virtual mapping in the /var/www/ folder

skipped: switch the old blogs wordpress URL inthe options table

sudo apt-get install webalizer
/etc/apache2/apache2.conf: Change
HostnameLookups Off
HostnameLookups On

/etc/webalizer/webalizer.conf: Change
LogFile /var/log/apache/access.log.1
LogFile /var/log/apache2/access.log

run it once: sudo webalizer then setup a cron job:
sudo crontab -e
and add the line:
0 * * * * webalizer

To get wordpress permalinks working
Change AllowOverRide None in /etc/apache/sites-available/default to AllowOverRide All

sudo a2enmod rewrite

sudo /etc/init.d/apache2 restart

since the word press url came over in the new database the last step is a direct cutover, log into the router and switch the port forwarding of 80 to the new server


Leave a comment

Posted by on March 29, 2011 in Network Admin


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: