Server Setup Guide Part 1 (CentOS, OpenLiteSpeed, Percona) (With Pictures!).

Wednesday, November 26, 2014

Server Setup Guide Part 1 (CentOS, OpenLiteSpeed, Percona) (With Pictures!).



Pre-Word and Disclaimer
This guide may not be published, broadcast, rewritten or redistributed in whole or part with out the express written permission of Slavik at XenForo.com. The author takes no responsbility for any steps, in part, or in whole, undertaken by users of this guide and does not guarantee against any losses, material or otherwise.


Introduction

This guide is going to explain how to set up a CentOS based server stack with the following configuration:
  • CentOS 6.x
  • OpenLiteSpeed
  • Percona MySQL
A short description of the above setup.

CentOS - Is a Linux distro based off Red Hat, an enterprise level OS, based on security and reliability.

OpenLiteSpeed - Is a new project based on the very powerful LiteSpeed web server. OpenLiteSpeed offers performance similar to Nginx, with a much more user-friendly interface and management.

Percona - Is a high performance MySQL server with many advanced features focused on InnoDB performance (of which XenForo relies heavily).


In Part 1 of this guide, we will perform the basic install and get things running. Part 2 (coming soon) will configure MySQL, LiteSpeed, PHP and basic security. Part 3 (coming soon) will install XenForo and PhpMyAdmin.


Tools Required

To make use of these guides you will need the following:
Prerequisites
  • Your server or VPS is running with the CentOS 6.x minimal install.
  • Root Login Details.
  • Your domain DNS A-records (usually @ and www) are updated to point to your server or VPS IP.
Installation Guide

Open up the Putty client. In the hostname or IP address box, enter the IP of your server. Unless specified otherwise by your web host, you will not need to change any other settings. Click open.

[IMG]


You will be prompted to download the server host key. Click yes.

[IMG]


Login using the username
Code:
root
and press enter.

[IMG]


Enter the password you chose on setting up the server, or the one pre-supplied by your host. Please note, the characters for the password will not be displayed as you type.

[IMG]


Congratulations, you should now be logged into your server!

[IMG]


Strangely, depending on your web host's individual setup, you may have some IP Tables rules, which, may either do nothing at all, or, more annoyingly, block all connections (aside from SSH) by default. In order to make sure they won't cause any issues during this guide, we will disable them (don't worry, later on we will add our own rulesets!).

To do this type the following

Code:
/sbin/service iptables stop
[IMG]


Which will provide the following output

[IMG]


Now, we run an update using the CentOS "yum" command to ensure everything is up-to-date.

Code:
yum update
[IMG]


yum will now check what packages installed on your system need updating and provide a list. It will ask for confirmation to continue and update the system.

Code:
y
[IMG]


yum will now download and install all the updates to your system. This may take several minutes, however, eventually you will get confirmation it has been successful.

[IMG]


Next we will install Percona as our MySQL server. Using the RPM command we will add the Percona yum repository to the system.

Code:
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
[IMG]

[IMG]


Now the repository is installed, we can install Percona itself.

Code:
yum install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-devel-55
[IMG]


Again, yum will ask to confirm the install

Code:
y
[IMG]


yum will also ask you to import the GPG-Key

Code:
y
[IMG]


And should then install

[IMG]


Now start MySQL.

Code:
/etc/init.d/mysql start
[IMG]

[IMG]


Secure your MySQL install by running

Code:
/usr/bin/mysql_secure_installation
[IMG]


Press "Enter" when asked for the MySQL root password and follow the on-screen prompts. Make sure your root MySQL password is a nice and strong one.

[IMG]

[IMG]

[IMG]

[IMG]

[IMG]

[IMG]


Now restart MySQL.

Code:
/etc/init.d/mysql restart
[IMG]

[IMG]


Now it's time to load OpenLiteSpeed, however, before doing that we need to ensure the right packages are installed. First, we will add the EPEL repo.

Code:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[IMG]

[IMG]


Differently to the Percona repo, we must manually retreive the GPG key.

Code:
wget http://fedoraproject.org/static/0608B895.txt
[IMG]

[IMG]


And move it to the right spot.

Code:
mv 0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[IMG]


When asked to confirm press

Code:
y
[IMG]


And finally install it

Code:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[IMG]


Next, install the tools and RPM's we need to install OpenLiteSpeed. As per the previous steps, when asked by yum to confirm installs, just press "y"

Code:
yum groupinstall 'Development tools'
[IMG]

[IMG]

[IMG]


Now install the required packages.

Code:
yum install bzip2-devel curl-devel pcre-devel expat-devel libc-client-devel libxml2-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel mhash-devel gd-devel openssl-devel zlib-devel GeoIP-devel
[IMG]

[IMG]

[IMG]


In order to enable SPDY in OpenLiteSpeed we require OpenSSL 1.0.1 or higher, unfortunately this doesn't come with any base yum repos, so lets install the IUS repo to do that.

Code:
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-11.ius.el6.noarch.rpm
[IMG]


Next install the Yum-Replace tool.

Code:
yum install yum-plugin-replace
[IMG]


Now replace and upgrade the OpenSSL version. A warning will be shown, this is normal, press Y to confirm, and the Y to install.

Code:
yum replace openssl --replace-with-openssl10
[IMG]

[IMG]

[IMG]


Now install the OpenLiteSpeed repo.

Code:
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm
[IMG]


Install OpenLiteSpeed

Code:
yum install openlitespeed
[IMG]


Once done, start OpenLiteSpeed with the command

Code:
/usr/local/lsws/bin/lswsctrl start
[IMG]


Finally, a little bit of cleanup.

Code:
yum clean all
[IMG]


Congratulations! LiteSpeed Web Server is now running and you have finished part one of this guide. You may now move on to part 2!


TLDR Version
For those who don't need the visual references and are comfortable with CentOS CLI, here are the commands run with no pictures.

/sbin/service iptables stop
yum update
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
yum install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-devel-55
/etc/init.d/mysql start
/usr/bin/mysql_secure_installation
/etc/init.d/mysql restart
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://fedoraproject.org/static/0608B895.txt
mv 0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
yum groupinstall 'Development tools'
yum install bzip2-devel curl-devel pcre-devel expat-devel libc-client-devel libxml2-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel mhash-devel gd-devel openssl-devel zlib-devel GeoIP-devel
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm
yum install openlitespeed
/usr/local/lsws/bin/lswsctrl start
yum clean all


Continue..............

0 comments :