Mysql
Make sure that Mysql is installed correctly and ensure it is running on startup.
sudo yum install mysql-serverNote: In case you run mysql on a dedicated server then you need not to install Mysql in the application servers, but make sure you install at least mysql-devel because it contains header files needed for Mysql gem installation.
sudo yum install mysql
sudo yum install mysql-devel
sudo checkconfig --level 345 mysqld on
Memcached
Memcache server needs livevent package as a dependency, so according to the deployment server system distribution we need to install the correct packages, in case of Centos 5 we are going to select the proper packages from Dag repositories from the following pages;
http://dag.wieers.com/rpm/packages/libevent/The following are the required steps to download and install memcached and libevent for centos 5.
http://dag.wieers.com/rpm/packages/memcached/
wget http://dag.wieers.com/rpm/packages/memcached/memcached-1.1.13-4.el5.rf.i386.rpmmemcached configuration could be found on /etc/sysconfig/memcached set the CACHESIZE to desired memory cache size you want.
wget http://dag.wieers.com/rpm/packages/libevent/libevent-1.3b-1.el5.test.i386.rpm
sudo rpm -ivh libevent-1.3b-1.el5.test.i386.rpm
sudo rpm -ivh memcached-1.1.13-4.el5.rf.i386.rpm
sudo /sbin/chkconfig --level 345 memcached on
Nginx
Get the latest nginx package tar, unpack it and configure it as follows. We need to install nginx required library first before configuring Nginx though. After compiling we need to copy nginx init script to /etc/init.d/nginx and give it execute permission.
sudo yum install pcreNote: you can use this conf file as a base for nginx configuration
sudo yum install pcre-devel
sudo yum install zlib
sudo yum install zlib-devel
sudo yum install openssl
sudo yum install openssl-devel
sudo ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-cc-opt="-I /usr/include/pcre" --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --conf-path=/etc/nginx/nginx.conf
make
make install
sudo cp nginx /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
Rubygems
If rubygems is installed but needs update run the following
sudo gem update --systemIf not installed get the latest version from here, unpack and install.
ruby setup.rbRails, Ferret, Rake
sudo gem install rails -yMongrel
sudo gem install rake
sudo gem install ferret
sudo gem install mongrelMongrel Cluster
Install Mongrel Cluster gem, and copy the service startup script and make sure it starts on system startup.
sudo gem install mongrel_clusterYou may need or should write your own mongrel_cluster configuration file, to define number of mongrel instances, user, group, port and other options. Here is an example:
sudo cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster /etc/init.d/
sudo cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/default.yml /srv/webapp/config/mongrel_cluster.yml
sudo /sbin/chkconfig --level 345 mongrel_cluster on
---You may need to add nginx user and group to your server
cwd: /srv/webapp/
port: "8000"
environment: production
address: 127.0.0.1
pid_file: log/mongrel.pid
servers: 8
group: nginx
user: nginx
/usr/sbin/useradd nginx
Mysql Ruby Driver
We have to do a little more than gem install here, cause it seems that Redhat based distros are putting Mysql in a place not expected by the gem installer. So we are going to either explicitly give ‘gem install’ the location of lib headers and include for mysql, or soft linking the /usr/include/mysql and /usr/lib/mysql folders before ‘gem install’. (The soft link solution works well for me in most servers)
sudo gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysqlOR
update: New version of rubygems require double dash before the compiler configuration options.
sudo ln -s /usr/lib/mysql/ /usr/local/libMemcached Ruby Driver
sudo ln -s /usr/include/mysql/ /usr/local/include/
sudo gem install mysql
sudo gem install memcache-client -y
Related links:
