Recently with a cPanel server, we had this issue of not being able to create postgresql database even after the postgresql package is installed and database server is running. Fixing of one issue lead to another there by needing to fix all the errors.
Cpanel::AdminBin::adminrun(postgres) set error in context postgres
[2010-01-16 12:24:18 -0500] warn [postgres::listdbs] Encountered error in postgres::listdbs: Error from postgres wrapper: PostgreSQL has not been configured by the administrator. Unable to locate pgpass file.
This was fixed by doing these,
Login to WHM => SQL Services => Postgres Config => Click on “Install Config”.
Login to WHM => SQL Services => Postgres Config => “Set a Postgresql password also”
No error in cPanel after doing above. However that followed by an issue of created DBs not being appeared in the List DB page of Postgresql databases. Went to shell. Logged in as root . Switched to postgres. “su – postgres” . Ran the command “psql” and then
-bash-3.2$ psql
Welcome to psql 8.1.18, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
postgres=# \l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)
postgres=# \q
No DB was created. Checked the logs /usr/local/cpanel/logs/error_log and it had entries like ERROR: role “username” does not exist which meant, no roles to create the database.
cd /var/cpanel/users && for x in *; do su -c "createuser -S -D -R $x" postgres; done
LSAPI is LiteSpeed’s open-source API between external applications and LiteSpeed Web Server. This how-to is for compiling and installing PHP + LSAPI on Linux, OS X, FreeBSD, Solaris, and so on. LiteSpeed comes with PHP 4.4.x compiled with LSAPI. To change the LightSpeed php to the latest stable one, we need to recompile the php with the LSAPI for LiteSpeed.
I am trying to provide some info for doing this task.
Instructions:
a) Download the required php from php.net
wget http://in2.php.net/get/php-5.2.11.tar.bz2/from/this/mirror
tar -xzvf php-5.2.11.tar.bz2
cd php-5.2.11/sapi
b) Download and the latest LSAPI for PHP from http://www.litespeedtech.com/ into the “sapi” folder of php source:
wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.10.tgz
tar -xvf php-litespeed-4.10.tgz
c) Change directory to root PHP source directory and run commands:
cd ..
touch ac*
./buldconf –force
d) Configure/Compiling
If you have an apache compilation already , remove the part option “–with-apxs” and use ” –with-litespeed” . Also you may need to change the “prefix” option too . So a basic configure command would be like this
./configure ‘–prefix=/lsphp5′ ‘–with-litespeed’ ‘with-mysql’
make
make install
Note: You must compile PCRE support inorder for the default auto-index php script to work correctly
Post Install Configurations
1. Replace the existing lsphp binary with the new one.
Change the directory to the current installation of “lsws” ( it varies on different machines)
cd /usr/local/lsws/fcgi-bin
mv lsphp lsphp.old
cp /php-5.2.11/sapi/litespeed/php lsphp-5.2.11
ln -sf lsphp5 lsphp-5.2.11
Check Installation
/usr/local/lsws/fcgi-bin/lsphp5 -v
It should return something like:
PHP 5.2.11 (litespeed) (built: Sep26 2008 14:09:09) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Notice litespeed in parenthesis. This means that the PHP binary has litespeed (LSAPI) support builtin.
The php.ini file will be located at /usr/local/lsws/php/php.ini
If we want to use the old PHP.ini just copy it here.
# cd /usr/local/lsws/php # mv php.ini php.ini.old # cp /usr/local/ZEND/etc/php.ini .
Finally restart LSWS and use our new PHP binary.
/usr/local/lsws/bin/lswsctrl restart
Continue Reading
Kernel Recompilation
Compiling custom kernel has its own advantages and disadvantages. It helps to optimize the kernel to your environment (hardware and usage patterns). I shall try to guide you through Kernel recompilation process.
Step 1:
Download the kernel source
cd /usr/local/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2
Note: Replace x.y.z with actual version number.
Step 2:
Extract the source file
tar -xjvf linux-x.y.z.tar.bz2
Step 3:
Patching the Kernel
If you are requested to apply any patches , follow these steps
a) Move the downloaded kernel patch to the /usr/local/src directory.
b) Extract the patch file
c) Patch the kernel source using the extracted patch file
cd /usr/local/src/linux-x.y.z
patch -p1 < patchfile-2.2.x
Now the Kernel Source is patched against known vulnerabilities.
Step 4:
Configuration
If you are trying to upgrade the Kernel of already running server , it is always better use the existing configuration. To do this follow these steps
#uname -a
Linux Server1 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
# cd /boot
There you can see different configuration files as given below
#ls
config-2.6.18-128.el5 initrd-2.6.18-128.el5.img message
config-2.6.18-164.el5 initrd-2.6.18-164.el5.img quota.user*
identify the configuration file corresponding to the version of OS installed , In our case it is config-2.6.18-164.el5 . We are copying this file to the downloaded kernel source to use it during configuration.
#cp -p config-2.6.18-164.el5 /usr/local/src/linux-x.y.z/.config
# make clean
# make mrproper
# make menuconfig
You have to select different options as per your need. If you intended to use the existing configuration ,specify the path to the file ( .config in this case) by selecting the option
“Load an Alternative configuration file”
Step 5: Compilation
Compile the Kernel using the following commands
Compile to create a compressed kernel image
# make
Compile kernel modules:
# make modules
Install kernel modules
# make modules_install
Step 6: Install Kernel
If the above steps completed without any errors , now its the time to Install the new Kernel
# make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file:
System.map-x.y.z
config-x.y.z
vmlinuz-x.y.z
Step 7: Create the Initrd image
Type the following command :
# cd /boot
# mkinitrd -o initrd.img-x.y.x x.y.z
initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires it, but it is better to create one
Step 8: Boot Loader Modification
Mofdify the boot loader to boot the new OS as default . Check the documentaions corresponding to your boot loader
Step 9: The last step
execute the following command
#reboot
Wait a few minutes and once it is up , you can see that the new Kernel is loaded
Situation & Requirement
Server crashed and had to be reinstalled. OS along with cPanel was re-installed on a fresh hard disk. Needed to restore the cPanel backup from old LVM hard disk to the new hard disk. That process wasn’t simple as I was getting unrecognised file system errors.
Solution
Made sure that the lvm tools are installed and available in the server. After that issued the following command
lvm vgchange –ignorelockingfailure -P -a y
The -P (Partial) will make logical volumes which are missing one of their disks available too.
vgchange — Change attributes of a volume group
–ignorelockingfailure — This lets you proceed with read-only metadata operations such as lvchange -ay and vgchange -ay even if the locking module fails. One use for this is in a system init script if the lock directory is mounted read-only when the script runs
-a — active or available
lvm lvs
The above command gives you output showing the name of the Volume Group and the name of the Logical Volume. The device entry will be created like /dev/VolGroup00/LogVol00/ and /dev/VolGroup00/LogVol01 etc. Finally run a fsck command to make it free of file system errors.
fsck /dev/VolGroup00/LogVol00
You are all set to go from here. As long as the lvm partition isn’t corrupt, following commands will get the oldhdd mounted to /oldhdd
mkdir /oldhdd
mount /dev/VolGroup00/LogVol00 /oldhdd
This isn’t my tutorial. “Shamelessly” leeched from http://www.techbytes.ca/techbyte118.html
Continue ReadingTo change the language settings of spamassassin edit the file user_prefs located at /home/username/.spamassassin if it isn’t located there you need to create one.
We need to edit or add values ok_languages with the extra languages you would like to have in the two letter code.
This option is used to specify which languages are considered OK for incoming mail.
Continue Readingok_languages all (allow all languages)
ok_languages en (only allow English)
ok_languages en ja hi (allow English, Japanese, and Hindi)