Archive for the ‘Cpanel’ category

How to install / reinstall RoundCube in Whm / cPanel (Linux)

June 5th, 2010

First make sure you know your mysql root password, you have to replace DATABASEPASSWORD to your mysql root password.

If you have already used RoundCube installation please make sure you remove any traces of it with,

cd /usr/local/cpanel/base
rm -rf roundcube*
mysql -p -e ‘drop database roundcube’;
chattr -i /usr/local/cpanel/base/frontend/x/webmaillogin.html
chattr -i /usr/local/cpanel/base/webmaillogin.cgi
/scripts/upcp

You will have to specify your root password when prompted.

Now lets download roundcube first and chmod the directorys

cd /usr/local/cpanel/base
wget -O roundcube.tar.gz http://heanet.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1-rc1.tar.gz
tar -zxvf roundcube.tar.gz
rm -rf roundcube.tar.gz
mv -f roundcubemail-0.1-rc1 roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs

Create the database and install the intial sql file. The following commands will do this for you.

mysql -e “CREATE DATABASE roundcube;” -pDATABASEPASSWORD
mysql -e “use roundcube; source SQL/mysql.initial.sql;” -pDATABASEPASSWORD

Now lets sort out the configuration

cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php

Now open db.inc.php

nano db.inc.php

Find

$rcmail_config['db_dsnw'] = ‘mysql://roundcube:pass@localhost/roundcubemail’;

Replace with

$rcmail_config['db_dsnw'] = ‘mysql://root:DATABASEPASSWORD@localhost/roundcube’;

Now Open main.inc.php

nano main.inc.php

Find

$rcmail_config['default_host'] = ”;

Replace with

$rcmail_config['default_host'] = ‘localhost’;

Now we have to configure cPanel to show roundcube in the theme. Please note this is for the X theme(default) only!! If you use another theme please skip the next part and see below.

cd /usr/local/cpanel/base/roundcube/skins/default/images/
cp –reply=yes roundcube_logo.png /usr/local/cpanel/base/frontend/x/images/roundcube_logo.png
cp –reply=yes roundcube_logo.png /usr/local/cpanel/base/webmail/x/images/roundcube_logo.png
cd /usr/local/cpanel/base
wget http://www.hostgeekz.com/files/hostgeekz/HGpatch-roundcube-0.1-rc1
patch -p0 < HGpatch-roundcube-0.1-rc1

**NOTE** If you receive a message stating

Reversed (or previously applied) patch detected! Assume -R?

please press N for No as this is because you previously installed roundcube

This will auto do all the necessary changes to roundcube and the X theme.

Once the patch is executed you may now access roundcube via http://yourip/webmail

—–

If you do not use the X theme please do the following

cd /usr/local/cpanel/base
wget http://www.hostgeekz.com/files/hostgeekz/HGpatch-roundcube-NON-X-0.1-rc1
patch -p0 < HGpatch-roundcube-NON-X-0.1-rc1

Then open your webmaillogin.html, please replace YOURTHEME with the name of your theme.

nano /usr/local/cpanel/base/frontend/YOURTHEME/webmaillogin.html

and find

</td>
</cpanelif>
</cpanelfeature>

Add Below

<td align=”center” valign=”bottom” width=”200″>
<a href=”/roundcube/index.php”><img src=”images/roundcube_logo.png” border=”0″></a>
<a href=”/roundcube/index.php”>RoundCube</a>
</td>

Remember to chattr +i the files or add the patch to your /scripts/upcp.

chattr +i /usr/local/cpanel/base/frontend/x/webmaillogin.html
chattr +i /usr/local/cpanel/base/webmaillogin.cgi

If you are using cPanel 11 ensure to run the following fix.

wget http://www.hostgeekz.com/files/hostgeekz/cpanel-11-fix.sh
chmod 700 cpanel-11-fix.sh
./cpanel-11-fix.sh
rm -f cpanel-11-fix.sh

That’s it! You may now access roundcube via http://yourip/webmail

How to change your FTP port in Cpanel

April 10th, 2010

While Cpanel comes with 2 different FTP programs; PureFTP and Proftp, there isn’t any way in Cpanel to change the default FTP ports. This leaves the server open to a possible brute force attack at the default port of 21. However by changing just one line in your FTP server configuration files, you can change up the FTP port and securing your server.

To do so, you must be logged into your server via SSH/Shell and you must use a text editior such as Nano, Pico, Vi / Vim.

Changing the port for Pure-FTP

1) Edit /etc/pure-ftpd.conf and look for the following line:

#Bind 127.0.0.1,21

The default example, 127.0.0.1, will cause the socket to bind locally but then this connection won’t serve externally. You’ll need to uncomment the line and change that to 0.0.0.0 so all IP’s will listen on that range and change the port of 40 to your desired ftp port.

2) If needed, add the new FTP port to your server’s firewall

3) Edit /etc/chkserv.d/ftpd and change the port, which is the first comma-separated entry to the right of ‘=’ on the line in the file, to match the port you put the service on.

Finally:

/etc/init.d/pure-ftpd restart
/etc/init.d/cpanel restart (restarts tailwatchd/chkservd)

Changing the port for ProFTP

Edit /etc/proftpd.conf and change:

Port 21

Fixing Munin MySQL Monitoring Plugin Graph That is Showing Blank (Cpanel)

January 5th, 2010

The error is due to a bug in a Perl library Munin uses which causes $PATH variable to be lost, and then causes the plugin cannot find the mysqladmin program which it needs to retrieve the numbers to populate in the graphs. Uninstall and reinstall Munin Service Monitor may make it works again, however, a more permanent solution is to hardcode the path of the program, which will fix the problem. Here the guide on how to specify the path to mysqladmin to Munin.

Fix for Munin installed by cPanel/WHM

   1. Determine where is mysqladmin program located with the one of the following command:

      which mysqladmin
      type mysqladmin
      locate mysqladmin

      If should return a path to mysqladmin which looks similar or the same to /usr/bin/mysqladmin.

   2. Edit the /etc/munin/plugin-conf.d/cpanel.conf Munin configuration file, and modify the [mysql*] to look like below:
      [mysql*]
      user root
      group wheel
      env.mysqladmin /usr/bin/mysqladmin
      env.mysqlopts –defaults-extra-file=/root/.my.cnf
» Read more: Fixing Munin MySQL Monitoring Plugin Graph That is Showing Blank (Cpanel)

Updating Cpanel Apache Configurations.

December 22nd, 2009

Nothing more than a “make sure you do this”, not really a knowledge base. It’s come to my attention that when people make changes to the httpd.conf on a server that is running Cpanel, that they don’t update the distiller file. So when they recompile apache, they lose any changes they made. Please be sure when you manually update httpd.conf that you save the changes to the distiller file by running the following;

/usr/local/cpanel/bin/apache_conf_distiller --update --main
*make sure if you copy and paste the command that it doesn’t replace the “-” with a “.”

Make sure that you modify the proper files when making the changes. For example to modify the number of servers that the Apache process can run, you will need to modify  /usr/local/apache/conf/extra/httpd-mpm.conf .

 StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0

 

If you need to modify the Time out settings, yo will need to modify the /usr/local/apache/conf/extra/httpd-default.conf .

# Timeout: The number of seconds before receives and sends time out.
#
Timeout 150

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off 

 

 

 

It will confirm that the changes were saved and this will save the changes to the main distiller config, saving them for all apache compiles.

You can test this by running the following to reload the httpd.conf and confirm the change;

/scripts/rebuildhttpdconf

Updating Apache using Cpanel’s EasyApache (SSH)

December 8th, 2009

EasyApache is a pre configured script that allows you to easily update Apache Web server through WHM or SSH.
In this tutorial we will show you how to update apache using SSH /scripts/easyapache.

Requirements:
Root SSH access to your server

Login as root through SSH.
1) Login to your server and su - to root.

Run EasyApache
2) /scripts/easyapache
3) Now once you are logged in and have ran the script, you will be presented with an option to choose a profile. Seeing that this is your first time (or not) you will want to choose “Start customizing based on profile” and hit enter. You move by using the arrow keys and using the space bar or mouse to choose and option if you need to fill one out (later in the tutorial).

easyapache11

4) Your next screen will to choose what version of apache you wish to run. Depending on what version of cpanel you are running, your options will be different. In my instance, I am using 11.24, so I have the option for Apache 1.3, 2.0 or 2.2. Your choose will depend on if you need certain features of that version of Apache. However when in doubt, google it my friends. I’ll choose 2.0 for this instance.

easyapache2

5) The next step will to choose what version of php you wish to use. Keep in might that Apache is constantly upgraded, so it’s usually best to go with the newest version.

easyapache3

6) After you choose your php version, you will be presented with what revision you want. Once again, rule of thumb is the newest should be the one you choose, unless your program requires a specific version of php.

easyapache4

7) Now we get to choose several options for apache / php. Assuming that you don’t need frontpage for example, or you do want mod perl or Zend, you would choose what options you need. These are not the final options for apache / php however, this will be done on the next screen. Unlike the other screens where you selected next step to move on, here you can either finish the build by choosing save and build (which will use previous settings) or you can choose exhaustive options list, where you can customize apache /php. Choose the later to continue.

easyapache5

8) Finally, we can choose what options are available for apache / php. This can be several screens long, so make sure you scroll up and down to view all the options. Once you have selected what you need, hit the next step.

easyapache6

9) Now, after choosing all your options, you have the ability to either save the build but not running it or save the build and running it. Once you decide to save and build, this process takes 15-30 minutes to complete. Once it does complete, httpd will restart and the new settings will take place.

easyapache7

That’s it. Take note that you can also run Apache from inside of WHM/CP, but it uses more memory due to the GUI, so t’s recommended to do this via SSH, esspecially if you are on a VPS with less than 512MB of memory or a heavily trafficed server.