Cpanel Installation
HowTo: Two way file sync between three or more servers
I was working in a project have multiple server, just assume that more than two, all those webservers are under loadbalancer and which doesn’t having centralize storage. So one thing I can do is sync files between the servers.
The first priority to avoid unwanted process and sync the file only if any updates happen, this action will effect all the servers.
I used the tool called Lsync + Unison
Lsyncd
Source : https://code.google.com/p/lsyncd/
Lsyncd watches a local directory trees event monitor interface (inotify or fsevents). It aggregates and combines events for a few seconds and then spawns one (or more) process(es) to synchronize the changes. By default this is rsync. Lsyncd is thus a light-weight live mirror solution that is comparatively easy to install not requiring new filesystems or blockdevices and does not hamper local filesystem performance.
Unison
Source : http://olex.openlogic.com/packages/unison
Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other. License GPLv3
Please follow the implementation steps below for all the servers, because each server should check for updates
Server1 : 192.168.1.51
Server2: 192.168.1.52
Server3: 192.168.1.53
Shared folder is same on all the server /home/syncfuser/fileupload
SSH port : 10022
Web root writable user : syncfuser
Installation
Add additional Centos repository here I used CentOS 6.4 64bit. you may get different version from the give link
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
[root@srv-51 ~]# rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm Retrieving http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm warning: /var/tmp/rpm-tmp.iORM9p: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY Preparing... ########################################### [100%] 1:rpmforge-release ########################################### [100%]
[root@srv-51 ~]# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Installing Lsycd , unison
[root@srv-51 ~]# wget http://lsyncd.googlecode.com/files/lsyncd-2.0.6.tar.gz
[root@srv-51 ~]# tar -zxvf lsyncd-2.0.6.tar.gz
[root@srv-51 ~]# cd lsyncd-2.0.6 ; make ; make install
[root@srv-51 ~]# yum install pkgconfig lua.x86_64 lua-devel.x86_64 lua-static.x86_64 gcc unison -y
[root@srv-51 ~]# touch /var/log/lsyncd/{lsyncd,lsyncd-status}.log
[root@srv-51 ~]# vi /etc/init.d/lsyncd #!/bin/bash # # chkconfig: - 85 15 # description: Lightweight inotify based sync daemon # # processname: lsyncd # config: /etc/lsyncd.conf # config: /etc/sysconfig/lsyncd # pidfile: /var/run/lsyncd.pid # Source function library . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 LSYNCD_OPTIONS="-pidfile /var/run/lsyncd.pid /etc/lsyncd.conf" if [ -e /etc/sysconfig/lsyncd ]; then . /etc/sysconfig/lsyncd fi RETVAL=0 prog="lsyncd" thelock=/var/lock/subsys/lsyncd start() { [ -f /etc/lsyncd.conf ] || exit 6 echo -n $"Starting $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else daemon /usr/local/bin/lsyncd $LSYNCD_OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch $thelock fi; echo return $RETVAL } stop() { echo -n $"Stopping $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else killproc lsyncd RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $thelock fi; echo return $RETVAL } reload(){ echo -n $"Reloading $prog: " killproc lsyncd -HUP RETVAL=$? echo return $RETVAL } restart(){ stop start } condrestart(){ [ -e $thelock ] && restart return 0 } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condrestart) condrestart ;; status) status lsyncd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" RETVAL=1 esac exit $RETVAL
chmod +x /etc/init.d/lsyncd
Before start configuring lsync please make sure that password less login is enabled for all the servers.
Create a new conf file /etc/lsyncd.conf
[root@srv-51 ~]# vi /etc/lsyncd.conf
settings = { logfile = "/var/log/lsyncd/lsyncd.log", statusFile = "/var/log/lsyncd/lsyncd-status.log", maxDelays = 3 } runUnison2 = { maxProcesses = 1, delay = 3, onAttrib = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.52:10022//home/syncfuser/fileupload", onCreate = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.52:10022//home/syncfuser/fileupload", onDelete = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.52:10022//home/syncfuser/fileupload", onModify = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.52:10022//home/syncfuser/fileupload", onMove = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.52:10022//home/syncfuser/fileupload", } runUnison3 = { maxProcesses = 1, delay = 3, onAttrib = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload", onCreate = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload", onDelete = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload", onModify = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload", onMove = "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload", } sync{ runUnison2, source="/home/syncfuser/fileupload" } sync{ runUnison3, source="/home/syncfuser/fileupload" }
Please use -confirmbigdel=false if you have clear Idea about what you are doing, which will give the power to remove the file forcefully even if the directory is to be empty.
With out -confirmbigdel=false will stop syncing (crash lsync) for the scenario ( directory going to be empty) . It will protect the file from accidentally removal commad rm -rf * , if it is a server you don’t need to worry about it because the file removal is handled by the application.
Sample logs for file syncs .
[root@srv-51 fileupload]# cat > samplefile-sv1.txt This is the sample file from server1. ^C
tail -f /var/log/lsyncd/lsyncd.log
Fri Jun 27 18:41:44 2014 Normal: Event Delete spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload" Fri Jun 27 18:41:44 2014 Normal: Event Delete spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.51:10022//home/syncfuser/fileupload" Contacting server... Contacting server... Connected [//srv-51//home/syncfuser/fileupload -> //srv-52//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Reconciling changes Connected [//srv-52//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Nothing to do: replicas have been changed only in identical ways since last sync. Fri Jun 27 18:41:44 2014 Normal: Retrying Delete on /home/syncfuser/fileupload//.unison.samplefile-sv1.txt.f629b5a5e1d6f2942bd1ec2ad54122b6.unison.tmp = 0 Fri Jun 27 18:41:44 2014 Normal: Event Create spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.51:10022//home/syncfuser/fileupload" Reconciling changes Nothing to do: replicas have been changed only in identical ways since last sync. Fri Jun 27 18:41:44 2014 Normal: Retrying Delete on /home/syncfuser/fileupload//.unison.samplefile-sv1.txt.f629b5a5e1d6f2942bd1ec2ad54122b6.unison.tmp = 0 Fri Jun 27 18:41:44 2014 Normal: Event Create spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload" Contacting server... Contacting server... Connected [//srv-51//home/syncfuser/fileupload -> //srv-52//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Reconciling changes Nothing to do: replicas have not changed since last sync. Fri Jun 27 18:41:44 2014 Normal: Retrying Create on /home/syncfuser/fileupload//samplefile-sv1.txt = 0 Connected [//srv-52//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Reconciling changes Nothing to do: replicas have not changed since last sync. Fri Jun 27 18:41:44 2014 Normal: Retrying Create on /home/syncfuser/fileupload//samplefile-sv1.txt = 0 Fri Jun 27 18:41:54 2014 Normal: Event Delete spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.51:10022//home/syncfuser/fileupload" Fri Jun 27 18:41:54 2014 Normal: Event Delete spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload" Contacting server... Contacting server... Connected [//srv-52//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Connected [//srv-51//home/syncfuser/fileupload -> //srv-52//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Looking for changes Waiting for changes from server Reconciling changes Reconciling changes Nothing to do: replicas have been changed only in identical ways since last sync. Fri Jun 27 18:41:54 2014 Normal: Retrying Delete on /home/syncfuser/fileupload//.unison.samplefile-sv1.txt.f629b5a5e1d6f2942bd1ec2ad54122b6.unison.tmp = 0 Fri Jun 27 18:41:54 2014 Normal: Event Create spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.51:10022//home/syncfuser/fileupload" Nothing to do: replicas have been changed only in identical ways since last sync. Fri Jun 27 18:41:54 2014 Normal: Retrying Delete on /home/syncfuser/fileupload//.unison.samplefile-sv1.txt.f629b5a5e1d6f2942bd1ec2ad54122b6.unison.tmp = 0 Fri Jun 27 18:41:54 2014 Normal: Event Create spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload" Contacting server... Contacting server... Connected [//srv-51//home/syncfuser/fileupload -> //srv-52//home/syncfuser/fileupload] Connected [//srv-52//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Looking for changes Reconciling changes Nothing to do: replicas have not changed since last sync. Fri Jun 27 18:41:54 2014 Normal: Retrying Create on /home/syncfuser/fileupload//samplefile-sv1.txt = 0 Waiting for changes from server Reconciling changes Nothing to do: replicas have not changed since last sync. Fri Jun 27 18:41:54 2014 Normal: Retrying Create on /home/syncfuser/fileupload//samplefile-sv1.txt = 0
[root@srv-52 fileupload]# cat >> samplefile-sv1.txt
File edited from server2. ^C Log:
Fri Jun 27 18:43:54 2014 Normal: Event Modify spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.53:10022//home/syncfuser/fileupload" Fri Jun 27 18:43:54 2014 Normal: Event Modify spawns shell "export HOME=/root ; /usr/bin/unison -batch -confirmbigdel=false /home/syncfuser/fileupload ssh://syncfuser@192.168.1.51:10022//home/syncfuser/fileupload" Contacting server... Contacting server... Connected [//srv-51//home/syncfuser/fileupload -> //srv-52//home/syncfuser/fileupload] Connected [//srv-52//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Looking for changes Looking for changes Waiting for changes from server Waiting for changes from server Reconciling changes changed ----> samplefile-sv1.txt local : changed file modified on 2014-06-27 at 18:43:50 size 65 rw-r--r-- srv-53 : unchanged file modified on 2014-06-27 at 18:41:51 size 38 rw-r--r-- Propagating updates UNISON 2.40.63 started propagating changes at 18:43:54.25 on 27 Jun 2014 [BGN] Updating file samplefile-sv1.txt from /home/syncfuser/fileupload to //srv-53//home/syncfuser/fileupload Reconciling changes changed ----> samplefile-sv1.txt local : changed file modified on 2014-06-27 at 18:43:50 size 65 rw-r--r-- srv-51 : unchanged file modified on 2014-06-27 at 18:41:51 size 38 rw-r--r-- Propagating updates UNISON 2.40.63 started propagating changes at 18:43:54.25 on 27 Jun 2014 [BGN] Updating file samplefile-sv1.txt from /home/syncfuser/fileupload to //srv-51//home/syncfuser/fileupload [END] Updating file samplefile-sv1.txt UNISON 2.40.63 finished propagating changes at 18:43:54.25 on 27 Jun 2014 Saving synchronizer state [END] Updating file samplefile-sv1.txt UNISON 2.40.63 finished propagating changes at 18:43:54.25 on 27 Jun 2014 Saving synchronizer state Synchronization complete at 18:43:54 (1 item transferred, 0 skipped, 0 failed) Fri Jun 27 18:43:54 2014 Normal: Retrying Modify on /home/syncfuser/fileupload//samplefile-sv1.txt = 0 Synchronization complete at 18:43:54 (1 item transferred, 0 skipped, 0 failed) Fri Jun 27 18:43:54 2014 Normal: Retrying Modify on /home/syncfuser/fileupload//samplefile-sv1.txt = 0
[root@srv-53 fileupload]# rm -rf samplefile-sv1.txt [root@srv-53 fileupload]# ll total 0 Log :
Connected [//srv-51//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Connected [//srv-52//home/syncfuser/fileupload -> //srv-53//home/syncfuser/fileupload] Looking for changes Waiting for changes from server Looking for changes Reconciling changes deleted ----> samplefile-sv1.txt local : deleted srv-51 : unchanged file modified on 2014-06-27 at 18:53:14 size 0 rw-r--r-- Propagating updates UNISON 2.40.63 started propagating changes at 18:53:31.85 on 27 Jun 2014 [BGN] Deleting samplefile-sv1.txt from //srv-51//home/syncfuser/fileupload Waiting for changes from server [END] Deleting samplefile-sv1.txt UNISON 2.40.63 finished propagating changes at 18:53:31.85 on 27 Jun 2014 Saving synchronizer state Reconciling changes deleted ----> samplefile-sv1.txt local : deleted srv-52 : unchanged file modified on 2014-06-27 at 18:53:14 size 0 rw-r--r-- Propagating updates UNISON 2.40.63 started propagating changes at 18:53:31.85 on 27 Jun 2014 [BGN] Deleting samplefile-sv1.txt from //srv-52//home/syncfuser/fileupload [END] Deleting samplefile-sv1.txt UNISON 2.40.63 finished propagating changes at 18:53:31.85 on 27 Jun 2014 Saving synchronizer state Synchronization complete at 18:53:31 (1 item transferred, 0 skipped, 0 failed) Fri Jun 27 18:53:31 2014 Normal: Retrying Delete on /home/syncfuser/fileupload//samplefile-sv1.txt = 0 Synchronization complete at 18:53:31 (1 item transferred, 0 skipped, 0 failed) Fri Jun 27 18:53:31 2014 Normal: Retrying Delete on /home/syncfuser/fileupload//samplefile-sv1.txt = 0
Now You have unique file in all the servers.
HowTo: Increase The Maximum Number Of Open Files / File Descriptors (FD)
Sometimes we will get the error message is like “too many files open“, it is because of you have reached the limits of opened file, You could always try doing a ulimit -n 2048. This will only reset the limit for your current shell and the number you specify must not exceed the hard limit.
Each operating system has a different hard limit setup in a configuration file. For instance, the hard open file limit on Solaris can be set on boot from /etc/system.
[anand@planetcure ~]$ cat /proc/sys/fs/file-max 172214
This show the maxmimum number of opened files for the single user, you can also use the below commad.
# ulimit -Hn # ulimit -Sn
We can set this as System-wide and userlevel, for Global user configuration we can use /etc/sysctl.conf file under Linux operating systems. So you can increase the maximum number of open files by setting a new value in kernel variable /proc/sys/fs/file-max as follows (login as the root):
System-wide File Descriptors (FD) Limits
# sysctl -w fs.file-max=100000
The command allows to extend the new limit as 100000. You need to append the variable “fs.file-max = 100000” in the file /etc/sysctl.conf for the permanent set. It won’t be change after the reboot.
#sysctl -p
Verify by using below command
#sysctl fs.file-max
User-level File Descriptors (FD) Limits
Some of the case we need to specify the different level of setting for the particular users. This will override the sysetm wide settings and give the new limits for the users.
To specific limits by editing /etc/security/limits.conf file, we can all so use this file for all user limits
For apache:
httpd soft nofile 1024 httpd hard nofile 2048
All user limits
* soft nofile 1024 * hard nofile 2048
Save and close the file. You have to re-login to the console to get the new value.
su httpd -c "ulimit -Hn" su httpd -c "ulimit -Sn"
Bash: History appending for multiple sessions
I got a requirement for listing all the command history if multiple terminal sessions using in different region for the single user. I followed the below steps.
step1 : Create a new file with the below entries
root@appserver:# cat /etc/profile.d/bash_history.sh function share_history { history -a history -c history -r } HISTSIZE=99999 HISTCONTROL=ignoredups HISTTIMEFORMAT=`echo -e "33[1;34m%d/%h/%Y 33[1;31m%H:%M:%S 33[0m"` PROMPT_COMMAND='share_history' shopt -u histappend
Step2: activate it in run-time
root@appserver:# source /etc/profile.d/bash_history.sh
Now you can see the list of aged histories
Sample Output :
1005 26/Dec/2013 14:23:08 vi /etc/profile.d/bash_history.sh 1006 26/Dec/2013 14:23:27 source /etc/profile.d/bash_history.sh 1007 26/Dec/2013 14:23:31 history
Info: Configure Redmine on cpanel hosting account with sending and receiving emails.
Wiki : http://en.wikipedia.org/wiki/Redmine
Redmine is a free and open source, web-based project management and bug-tracking tool. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. It handles multiple projects. Redmine provides integrated project management features, issue tracking, and support for various version control systems.
The design of Redmine is significantly influenced by Trac, a software package with some similar features.
Redmine is written using the Ruby on Rails framework. It is cross-platform and cross-database. It is part of the Bitnami app library that provides an installer and virtual machine for ease of deployment.
Before starting installation you have to make sure that Ruby on rails is working fine in your environment, If not you can follow the installation document for more help.
Installaing Ruby on Rails with Cpanel : https://enlook.wordpress.com/2013/11/19/howto-install-ruby-on-rails-with-cpanel/
Once you have done, then start the redmine installation steps.
Login to the terminal using primary account logins.
#ssh myaccount@mydomain.com
- Create rails_app folder and redmine folder within it then go inside that folder
# mkdir -p ~/rails_apps/redmine/ # cd ~/rails_apps/redmine/
- Download redmine redmine-2.3.3 or latest stable version, extract it and move the content out of it, then delete the files not being used.
-
# wget http://files.rubyforge.vm.bytemark.co.uk/redmine/redmine-2.3.3.tar.gz # tar -zxvf redmine-2.3.3.tar.gz # mv redmine-2.3.3/* ./ # rm -rf redmine-2.3.3/
-
- Move example files where they can be used
# cd config # mv database.yml.example database.yml # mv configuration.yml.example configuration.yml
- Creating the MySQL Database/User/Password
Login to Cpanel account, Create a database , user and grant full privilege to the new user for the particular database.
- Modifying your database.yml file.
# vi database.yml production: adapter: mysql database: redmine host: localhost username: myaccount_databaseuser password: newpassowd encoding: utf8
- Updating the ~/rails_apps/redmine/public/.htaccess file
# cd ../public/ # pwd
- You should see something similar to this.
/home/myaccountuser/rails_apps/redmine/public
- Add these lines
Options -MultiViews PassengerResolveSymlinksInDocumentRoot on #Set this to whatever environment you'll be running in RailsEnv production RackBaseURI / SetEnv GEM_HOME /home/myaccountuser/rails_apps/redmine/public # set to resolve avoid rails control to the folder for image resolution RewriteEngine On RewriteCond %{REQUEST_URI} ^/images.* RewriteRule .* - [L]
- Create a subdomain eg: projects.mydomain.com
Follow cpanel procedure to create subdomain. - Remove projects folder inside public_html and create symbolic link.
# rm -rf ~/public_html/projects
- Creating the symlink
# ln -s ~/rails_app/redmine/public ~/public_html/projects
- Updating Environment variables in ~/.bashrc file
- Add these lines to the bottom of your ~/.bashrc file
export HPATH=$HOME export GEM_HOME=$HPATH/ruby/gems export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3 export GEM_CACHE=$GEM_HOME/cache export PATH=$PATH:$HPATH/ruby/gems/bin export PATH=$PATH:$HPATH/ruby/gems
- after which source your .bashrc file
# source ~/.bashrc
- You will then need to check your rails version
rails -v && rake --version && gem -v
- You should get this message
Rails 4.0.1 rake, version 0.9.2.2 1.8.23
- Running bundle install
# cd ~/rails_apps/redmine/ # bundle install # rake generate_session_store
- Running generate_session_store or generate_secret_token
-
# rake generate_session_store
- If you get an error saying that command is deprecated, run this command instead;
# rake generate_secret_token
-
- Start the site session
# rake db:migrate RAILS_ENV=production
- Configuring outgoing emailsUpdate the setting in configuration.yml
default: email_delivery: delivery_method: :smtp smtp_settings: address: localhost port: 25 domain: mydomain.com authentication: :none enable_starttls_auto: false
Now the redmine have capable to send emails using exim install in the cpanel server.
- Configuring Incomming emails for IMAPCreate a cron job for the script to get continuous email feaching
For the first this script must execute from the terminal, so it will display error if any.
/usr/bin/rake -f /home1/innovat4/rails_apps/redmine/Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" port=143 host=mydomain.com username=projects@mydomain.com password=myemailpassword
For more help follow the official link http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails#Enabling-unknown-users-to-create-issues-by-email
Note : Each configuration required rails environment reboot for that you can follow the simple way.
# touch ~/rails_app/redmine/tmp/reboot.txt
Howto: Install Ruby on Rails with Cpanel
Installing Ruby on Rails on cPanel
Start the installation steps with root privileged or sudo user or you have to submit a tickte to your hosting provider for enabling Ruby on rails in you hosting account.
For detailed information about RubyGems: commands and system, read their User Guide Manuals at: www.rubygems.org/
– To install Ruby on Rails:
SSH to the server and run this command:
- /scripts/installruby
If LIBSAFE is installed on your server, you need to add the directive /usr/bin/ruby to the exception list to prevent buffer overflow errors. SSH to the server and run this command:
- echo “/usr/bin/ruby” >> /etc/libsafe.exclude
The local path to the binary package is:
/usr/bin/gem
To check on the current version installed on your server:
- /usr/bin/gem -v
To list all installed gems:
- /usr/bin/gem -l
– To uninstall Ruby on Rails:
- List all the gems installed on your server and remove them all using the following command:
- /usr/bin/gem uninstall NAME_OF_GEM
The cPanel/WHM, by default, installs the following Gems:
rails, mongrel, fastthread, actionmailer, actionpack, activerecord, activeresource, activesupport, cgi_multipart_eof_fix, daemons, gem_plugin, rake. For example, to uninstall the Gem: rails, we’ll run this command:- /usr/bin/gem uninstall rails
Sample output:
Successfully uninstalled rails version 0.1.6 - Remove Gem directories and the binary package using the following commands (in that order):
- /bin/rm -rf /usr/lib/ruby
- /bin/rm -rf /home/cprubygemsbuild
- /bin/rm -fv /root/.gem
- /bin/rm -fv /usr/bin/gem
- Remove all ruby directories added to a client’s root directory. The local path is: /home/USER/ruby/
- Restart the cPanel (un-necessary but do it any way)
- /sbin/service cpanel restart
Info: NFS Server&Client Setup
Server Side
NFS share with read/write privilege for the specified UID and GID, So even root will denied to write or read in that particular mount point and completly secure from everything.
Install required packages of NFS server.
apt-get install nfs-kernel-server nfs-common portmap
After the installation of NFS server edit /etc/exports fileand add a line as follows.
/mnt/nfs 192.168.0.0/24(rw,sync,anonuid=106,anongid=114,no_subtree_check) ↓ ↓ ↓ NFSsharepath | network | Options(Here we need to set user id and group id of tomcat user)
Restart nfs server after making necessary changes in the exports file.
#service nfs-kernel restart
Client side Linux
Install nfs client packages on NFS client machine. Mount nfs share in the client machine.
apt-get install portmap nfs-common
Make the following entry in /etc/fstab/
192.168.1.175:/mnt/nfs /home/nfs nfs rsize=8192,wsize=8192,timeo=14,intr ↓ ↓ ↓ Network share details Mount point Filesystem
Client Side Windows
Install nfs services for windows through control panel add or remove windows component wizard.
Edit Windows registery and make changes as follows in the registery.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS \CurrentVersion\Default
1, Create two DWORD values namely AnonymousUid and AnonymousGid
2, Set these values to the UID and GID as set in the NFS server for tomcat user (Eg:-106,114)
3, Restart NFS service.
Go to all programs- Administrative tools- Services for network filesystem and Start service of ClientForNFS.
Select properties of clientfornfs and set permissions as per the requirement. (Eg:- Read&write permission for the
Howto : Install yum after installing OS on centos
Yum is a awesome tool written in python used to install packages in redhat flavours. It have ability to choose dependency packages as it own from the repository needed by the installing packages. If you missed to find yum in your server, follow the below steps to install
you can get the packages from here ftp://rpmfind.net/linux/centos/6.4/os/x86_64/Packages/
Use wget to download these pacakages.
Package list:
gpgme-1.1.8-3.el6.x86_64.rpm
pygpgme-0.1-18.20090824bzr68.el6.x86_64.rpm
python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-pycurl-7.19.0-8.el6.x86_64.rpm
python-urlgrabber-3.9.1-8.el6.noarch.rpm
rpm-4.8.0-32.el6.x86_64.rpm
rpm-python-4.8.0-32.el6.x86_64.rpm
yum-3.2.29-40.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
upgragde rpm to latest version to avoid package confilct error follow the below switchs
[root@anand ~]# cd /root/installer/ [root@anand installer]# rpm -ivh --replacefiles rpm-4.8.0-32.el6.x86_64.rpm warning: rpm-4.8.0-32.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] 1:rpm ########################################### [100%] [root@anand installer]# mv rpm-4.8.0-32.el6.x86_64.rpm ../. [root@anand installer]# rpm -ivh * warning: gpgme-1.1.8-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] 1:yum-metadata-parser ########################################### [ 11%] 2:rpm-python ########################################### [ 22%] 3:python-pycurl ########################################### [ 33%] 4:python-urlgrabber ########################################### [ 44%] 5:python-iniparse ########################################### [ 56%] 6:gpgme ########################################### [ 67%] 7:pygpgme ########################################### [ 78%] 8:yum-plugin-fastestmirro ########################################### [ 89%] 9:yum ########################################### [100%]
Now you can create a package repository as your own. floks 🙂
Error: No space left on device: mod_rewrite: Parent could not create RewriteLock file
[Thu Jun 20 20:04:20 2013] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock Configuration Failed
Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.
Using the below command you can semaphores list.
root@server04 [~]# ipcs -s | grep nobody
So, In-order to clear the semaphores list. We have execute the following command.
root@server04 [~]# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem
After clearing the semaphores list, restart the apache server. Now, it will starts without any issues.But, it is an temporary solution it will re-occur when Semaphores get full.
Add following lines in “/etc/sysctl.conf” to get this issue fixed permanently. These values will increase the limits of Semaphores on the Server.
# Increases the semaphore limits & extend Apache’s uptime.
kernel.msgmni = 512 kernel.sem = 250 128000 32 512
Then load the new settings into the kernel using the command.
root@server04 [~]# sysctl -p
info: How to install java on Ubuntu.
Java is a object-oriented computer programming language developed by James Gosling at Sun Microsystems and released in 1995 lated it has been migrated to
Oracle systems. The code that can runs on one platform does not need to be recompiled.
Install oracle java 7 in ubuntu 12.04
Here I have described about one of the easiest installation method of Oracle-JAVA on Ubuntu using JAVA repository. for more information : http://en.wikipedia.org/wiki/Java_(programming_language)
Open the terminal and run the following commands
# java -version java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1) OpenJDK Server VM (build 20.0-b12, mixed mode) # sudo add-apt-repository ppa:webupd8team/java # sudo apt-get update # sudo apt-get install oracle-java7-installer
Now check the new updated verison
# java -version java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)
Check the installation directory:
anand@desktop:~$ ll /usr/lib/jvm/java-7-oracle/ total 19720 drwxr-xr-x 8 root root 4096 May 3 09:32 . drwxr-xr-x 6 root root 4096 May 3 09:32 .. drwxr-xr-x 2 root root 4096 May 3 09:32 bin -r--r--r-- 1 root root 3339 May 3 09:32 COPYRIGHT drwxr-xr-x 4 root root 4096 May 3 09:32 db drwxr-xr-x 3 root root 4096 May 3 09:32 include drwxr-xr-x 5 root root 4096 May 3 09:32 jre drwxr-xr-x 3 root root 4096 May 3 09:32 lib -r--r--r-- 1 root root 40 May 3 09:32 LICENSE drwxr-xr-x 4 root root 4096 May 3 09:32 man -r--r--r-- 1 root root 114 May 3 09:32 README.html -rw-r--r-- 1 root root 443 May 3 09:32 release -rw-r--r-- 1 root root 19838528 May 3 09:32 src.zip -rw-r--r-- 1 root root 123324 May 3 09:32 THIRDPARTYLICENSEREADME-JAVAFX.txt -r--r--r-- 1 root root 172252 May 3 09:32 THIRDPARTYLICENSEREADME.txt
That’s all 🙂
Error: Native SSL support failed to pass the startup test.
If you are getting above error then it mean CPanel has been updated to the lasted version and it also updates the “Net::SSLeay” version to 1.36 and that is why you get the error :
Native SSL support failed to pass the startup test. stunnel was started instead. The exact error was: [linktest=BinCheck ok ] [binary=/usr/local/cpanel/cpsrvd-ssl] [cpsrvd=Net::SSLeay object version 1.36 does not match $Net::SSLeay::VERSION 1.32. ]
In order to fix this follow the below steps :
1) Download the Net_SSLeay 1.30 or 1.32
root@server[#] cd /usr/local/src root@server[#] wget http://mirror.yourconnect.com/CPAN/authors/id/F/FL/FLORA/Net_SSLeay.pm-1.30.tar.gz
or
root@server[#] wget http://mirror.yourconnect.com/CPAN/authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar.gz
2) Then extract the tar.gz file
root@server[#] tar -zxf Net_SSLeay.pm-1.30.tar.gzor
root@server[#] tar -zxf Net-SSLeay-1.32.tar.gz
Then go to dir Net_SSLeay.pm-1.30 or Net-SSLeay-1.32
root@server[#] cd Net_SSLeay.pm-1.30/or
root@server[#] cd Net-SSLeay-1.32/
and then execute Make file and then perform make install
root@server[/usr/local/src]# ./Makefile.PL -t root@server[/usr/local/src]# make install
Now, finally you can check the installed module from WHM >> Main >> Software >> Install a Perl Module
That’s all you are done.