Linux: Remove WHM Disk Warning

cpanel_logo

 

There are many times I am seeing the error below when accessing to the WHM.

Sorry for the inconvenience!
The filesystem mounted at / on this server is running out of disk space. cPanel operations have been temporarily suspended to prevent something bad from happening. Please ask your system admin to remove any files not in use on that partition.

And even after I have cleared the disk space from the server, WHM doesn’t allow me to access to WHM interface.

To get this issue fixed, you may remove the following files and retry again,

/root/.cpanel/datastore/_bin_df_-P_-k_-l

cPanel: How to install mod_geoip

There are many ways to install mod_geoip in the web but the easiest way to compile it with cPanel server is to compile it through the easyapache.

To get it done, run the following command as root,

cd /var/cpanel/easy/apache/custom_opt_mods/
wget http://docs.cpanel.net/twiki/pub/EasyApache3/CustomMods/custom_opt_mod-mod_geoip.tar.gz
tar -zxf custom_opt_mod-mod_geoip.tar.gz

Next compile it with easyapache,

/scripts/easyapache

Then select the Mod_GeoIP in the Short Options List.

cPanel: Howto Resize tmp

This article will guide you how to resize the tmp drive from your cPanel server.

To get rid of /tmp drive keep on full, you may follow the following step,
1.  Stop the following services,

service httpd stop
service mysql stop

2. Un-mount the following drive

umount /var/tmp
umount /usr/tmp (if you are using VPS)
umount /tmp

3. Remove the temporary space

rm -f /usr/tmpDSK

4. Assign the tmp drive space (in bytes).

replace 512000 [value] -- /scripts/securetmp

Assign /tmp to 1GB
eg. replace 512000 1024000 -- /scripts/securetmp

5. Execute and apply it.

/scripts/securetmp

6. Start the services again,

service mysql start
service httpd start

 

cPanel: Prevent certain domain to be created

With cPanel 11.32 and above, you may prevent certain domain to be created from your server such as google.com, yahoo.com, microsoft.com, and etc.

To see which domain are blocked by default, view the file /usr/local/cpanel/etc/commondomains.

To block the domain to be created.
1. Create file /var/cpanel/commondomains.
2. Insert the domain list to the above file and each domain should be in new line.

Centos: List SSH user last password changed date with cPanel

To secure your server with cPanel, you might want to consider to request your cPanel user to change your password quarterly.

To get this done, you may consider to use the command name chage.

[email protected] [~]# chage -l username
Last password change                                    : Jul 28, 2012
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7

To list all user Last password change date, you may do with the following command,

for i in `ls -l /var/cpanel/users | grep -vE '(\.|system)'| awk '{print $9}'`;do echo $i&&chage -l $i|grep Last;done;

SSH: jailshell: fork: retry: Resource temporarily unavailable – Part 2

To continue to the article of http://www.mickgenie.com/ssh-jailshell-fork-retry-resource-temporarily-unavailable/, I have found out another way to get this issue fixed.

To fix this issue,

1. Log into the WHM.
2. Suspend the account that having these error.
3. Unsuspend the account.

The issue should fixed automatically.

How to Install Redmine 1.4 with cPanel 11.32

The reason I repost this article is because my previous article is old enough and I still can see the demand on this task.

Requirement:
– Ruby On Rails 1.8.x enabled, please downgrade to 1.8.7, 1.9.2 or 1.9.3 if your are running higher than that. To check the Ruby version, type “ruby -v” from shell.
– Shell Access(SSH) enabled
– MySQL Enabled
– Rubygems <= 1.8

Pre-Step:
1. Install gem rails version 2.3.14(exact version), from SSH shell, run

gem install rails -v=2.3.14

2. Install gem rack version 1.1.3, from SSH shell, run

gem install rack -v=1.1.3

3. Install gem rubygems 1.8.23(or higher version, not >= 1.8), from SSH shell, run

rubygems-update

If it is not working, refer to http://www.mickgenie.com/how-to-update-rubygems/.
4. Create MySQL database from your cPanel and I assume that you are using the database as detail below.
Database Name: mickgenie_redmine
Username: mickgenie_redmine
Password: StR0NgPa$$w0Rd

Installation Step:
1. Log into the cPanel, click on Ruby On Rails.
2. In the App Name, enter Redmine, environment session select Production and create the App.
3. Click on Create Rewrite button and enter the subdomain or path that needed, then save it.
4. Download Redmine from RubyForce.
5. Upload through File Manager according to the path that you created from the Ruby On Rails.
6. Extract the file to the RoR Apps.
7. Install bundler gem by enter,

gem install bundler

8. Now, run the following command to install all the required gem from Redmine,

bundle install --without development test postgresql

9. Rename the in config/database.yml.example to config/database.yml.
10. Open the database.yml file and look for the production section.
11. Modify the production section as detail below.
production:
adapter: mysql
database: mickgenie_redmine
host: localhost
username: mickgenie_redmine
password: StR0NgPa$$w0Rd

(These information is create as above).
12. Create session store secret.

rake generate_session_store

13. Create the database structure.

RAILS_ENV=production rake db:migrate

14. Create default data.

RAILS_ENV=production rake redmine:load_default_data

15. You have done the installation, just go to cPanel and start the mongrel.

Final Step:
You may now log into Redmine with detail below,
Username: admin
Password: admin

SSH: jailshell: fork: retry: Resource temporarily unavailable

Today, one of the customer SSH(cPanel) getting error as below when they logged into their jailed shell access.

-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable

To overcome the problem, simply run the following command from root.

for i in `ps aux | grep username | awk '{print $2}'`; do kill -9 $i; done

for i in `cat /proc/mounts | grep username | awk '{print $2}'`; do umount $i; done

Where you should replace the username to your created user.