Articles in the ‘Server Administration’ Category

Clear MySQL bin log files

Monday, December 12th, 2011

You need MySQL bin logs only if you are replicating the databases.

1. Disable bin logging
nano /etc/my.cnf
2. Comment all bin logging related lines

#log_bin = /var/log/mysql/mysql-bin.log
#expire_logs_days = 10
#max_binlog_size = 100M

3. Restart MySQL
4. Delete the bin log files by entering in mysql with:
mysql
5. Run the following command:
PURGE BINARY LOGS TO 'mysql-bin.03';

where 03 is the last number of the bin log you want to clear.

Create a repository in XEN server

Thursday, November 24th, 2011

1. Be sure that you have the path created. In the above example it’s /var/opt/xen/iso_import.
2. Copy the ISO images directly in this folder (Centos ISO images works fine).
3. Use the following command to create a local repository in XEN

xe sr-create name-label="S5 Repository" type=iso device-config:location=/var/opt/xen/iso_import/ device-config:legacy_mode=true content-type=iso

4. In XENCENTER use the OTher media install to create VMs.

Ignore folder in SVN

Thursday, October 6th, 2011

Use this:

DIRNAME
-CHILD1
-CHILD2

DIRNAME> svn propset svn:ignore CHILD1 .

attention! You have to be inside DIRNAME.

Error: Missing Dependency: perl-String-CRC32

Tuesday, September 13th, 2011

Fixing this error:

--> Missing Dependency: perl(String::CRC32) is needed by package lftp-3.7.11-4.el5_5.3.x86_64 (base)
Error: Missing Dependency: perl-String-CRC32 is needed by package lftp-3.7.11-4.el5_5.3.x86_64 (base)
Error: Missing Dependency: perl(String::CRC32) is needed by package lftp-3.7.11-4.el5_5.3.x86_64 (base)

You just need to install the Perl module. To do this, login to SSH as root and type:

perl -e shell -MCPAN

If it asks you to set it up, just type “no” and it’ll use the defaults.

cpan> install String::CRC32
cpan> exit

How to install EPEL repository cPanel CENTOS?

Thursday, August 4th, 2011

1.Download the latest EPEL repository for I386
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

2. Download the latest EPEL repository for x86_64
wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm

3. Run the rpm install command
rpm -Uvh epel-release-5*.rpm

If you want to change the priority of the repository edit this file :
/etc/yum.repos.d/epel.repo
And change this value :
priority=2

How to check SDA drive speed in Linux?

Sunday, July 31st, 2011

Use the following command:

hdparm -tT /dev/sda1

A good test result is this one:
# hdparm -tT /dev/sda1

/dev/sda1:
Timing cached reads: 21416 MB in 1.99 seconds = 10785.03 MB/sec
Timing buffered disk reads: 106 MB in 3.01 seconds = 35.16 MB/sec

How to password protect folders in Apache?

Tuesday, July 26th, 2011

You need to add the following lines in .htaccess

AuthUserFile /home/site-name/public_html/.htpasswd
AuthName "Login Area"
AuthType Basic
require user user-name

then create a .htpasswd file in /home/site-name/public_html/ with the following content:
user-name:faut1Lbo9LqK8NgU0

where “faut1Lbo9LqK8NgU0″ is the hash of the password. You can generate an has with this link: http://www.htaccesstools.com/htpasswd-generator/

Convert MYSQL tables to INNODB script

Tuesday, July 12th, 2011

If you want to convert MYSQL tables to INNODB use the following script:

mysql -u root -p -e "SHOW TABLES IN DATABASE-NAME;" | tail -n +2 | xargs -I '{}' echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
and then run:
perl -p -i -e 's/(search_[a-z_]+ ENGINE=)INNODB/\1MYISAM/g' alter_table.sql

Replace “DATABASE-NAME” with your database name. You also need root access (preferably).

How to add MSSQL support in PHP5 cPanel CENTOS

Thursday, June 2nd, 2011

If you want to add MSSQL support in PHP5 cPanel CENTOS, follow the next steps:

1. First, we need to install FreeTDS
wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
tar -zxvf freetds-stable.tgz
cd freetds-*

2. Begin the configuration process:
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld

Note
Use tdsver=8.0 if you have SQL 2000/2005, tdsver=7.0 if you have SQL 7.0….

3. Compile FreeTDS
make && make install

4. Add the following line in the file /etc/ld.so.conf :
include /usr/local/freetds/lib

5. Run the following command
ldconfig -v

6. Add mssql to compile options of EasyApache
nano /var/cpanel/easy/apache/rawopts/all_php5
and add:
--with-mssql=/usr/local/freetds

7. Run /scripts/easyapache or build it from WHM. You don’t need to select any additional options here. Just build it. Once the build completes, you should now be able to use PHP’s MSSQL connector functions.

Note
If you are running a 64bit OS and get an error about configure: error:
Could not find /usr/local/freetds/lib64/libsybdb.a|so
then you need to do the following:


ln -s /usr/local/freetds/lib/libsybdb.so.5 /usr/lib64/libsybdb.so.5
ln -s /usr/local/freetds/lib/libsybdb.so.5 /usr/local/freetds/lib64/libsybdb.so
ldconfig -v

Internal Server Error Mailman cPanel

Wednesday, May 18th, 2011

If you have

Internal Server Error

while accessing :

http://SITE-URL/mailman/admin/LIST-NAME

you have to fix some permission problems in the mailman.

chmod 02755 -R /usr/local/cpanel/3rdparty/mailman
/usr/local/cpanel/3rdpart/mailman/bin/check_perms -f
chmod 02775 -R /usr/local/cpanel/3rdparty/mailman/logs

That’s it!