affiliate_link
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts


PHPIZE is a part of the PHP Development package. All you have to do is to login to your linux server, and execute:

yum -y install php-devel

And that's it. Installation should be complete in less than 5 minutes.

How to install Yum on VPS


Here's a quick how to in installing yum to your VPS. I don't know about you but Virtuozzo or the Parallels team told us that it should be included in the VPS template. I am running Virtuozzo version 4 and for some reason, yum isn't installed. You should be able to install it with a flick by trying out my solution:

Linux distro: Centos 4.4

1. Login to your box thru ssh using any of your favorite ssh clients. I used mRemote.

2. Create the directory yum under /usr/src. (Optional)

3. Download the following files using the wget tool:

a. python-urlgrabber-2.9.6-2.noarch.rpm
b. python-sqlite-1.1.6-1.i386.rpm
c. python-elementtree-1.2.6-4.i386.rpm
d. python-urlgrabber-2.9.6-2.noarch.rpm
e. sqlite-3.2.2-1.i386.rpm

Usage: wget
Sample: wget http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/python-2.3.4-14.7.el4.i386.rpm

4. Run this command:

# rpm -Uvh *rpm

5. Download yum:

a. centos-yumconf-4-4.3.noarch.rpm
b. yum-2.4.0-1.centos4.noarch.rpm
c. yum-metadata-parser-1.0-8.el4.centos.i386.rpm

6. Proceed with item no.4.

You should be able to see a successful installation afterwards.

For an updated version of the yum dependencies and yum itself, visit Centos' repository. And speaking of dependencies, other's might encounter a dependency issue when installing components manually. Do drop by and post a quick comment and we'll try to sort things out.

Have a nice yum day!


Well what a week. Thank you readers for dropping by at my tech blog once in a while. I know i don't frequently update it due to lack of time but here I am, ready to post new ideas again.

Yesterday, we ran into a "not so difficult" problem, at all. Here's the story.

We need to install the Sitebuilder package since one of the clients need the application. We installed the Sitebuilder support using the Plesk updater. Installation successful as per Plesk but upon checking, still no sitebuilder support. Next step, we did an upgrade from Plesk 8.4 to Plesk 8.6. We got a prompt again saying that the upgrade was successful. Ok got it. But, after a few minutes, Plesk started acting really weird. We checked the status of the PSA service and here comes the real fiasco. We got an error of course:

psa dead but subsys locked


Oh not again. I happen to encounter this kind of problem on the http, vsftp etc daemons. But I can easily fix them by just restarting the machine or deleting the corresponding /var/lock/subsys file and then start the service again. I did this for a couple of times for the PSA service but to no avail, Plesk isn't just working! I looked at the logs and I just can't find any clues there.

Well, what we did is to email the Parallels Support team. We didn't got any answer overnight so we are feeling a bit hopeless about the case. The next morning, ideas are fresh and we started looking at the key answer to the problem.

/tmp/autoinstaller3.log

So yup. I looked into the updater logs and found this:

Trying to establish test connection... ERROR 1044 (42000): Access denied for user 'root'@'%' to database 'mysql'
Trying to establish test connection... ERROR 1044 (42000): Access denied for user 'root'@'%' to database 'mysql'
Trying to establish test connection... ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: N
O)
Trying to establish test connection... ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: Y
ES)
Trying to establish test connection... ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: N
O)
Trying to establish test connection... ERROR 1044 (42000): Access denied for user 'root'@'%' to database 'mysql'
Trying to establish test connection... Could not open required defaults file: /root/.my.cnf
Fatal error in defaults handling. Program aborted

ERROR while trying to establish test connection

Check the error reason(see log file:
/tmp/psa_8.6.0_cos4.build86080722.02_upgrade.090207.07.37.log), fix and try
again

Aborting...

error: %post(psa-8.6.0-cos4.build86080722.02.i586) scriptlet failed, exit
status 1

Attention! Your software might be inoperable.
Please, contact product technical support.



Unable to connect to Mysql? Duh?. FYI, the script looks into the .psa.shadow for the mysql password. But here's the dish. We can login into the mysql server using the password defined in the .shadow file. So how come we cannot run the upgrade without the creepy errors?

Per Parallels support, we we're running a "mixed" version of Plesk. Probably because of the failed upgrade.

Just in case you noticed this error, I stumbled into a knowledgebase entry regarding the /root/.my.cnf file.

SYMPTOMS:

Plesk upgrade or installation fails with the error in upgrade log:

Access denied for user 'admin'@'localhost' (using password: YES)\n")


RESOLUTION:

Make sure that there is no /root/.my.cnf file with MySQL password. Plesk uses environment variable to pass the password to MySQL server, but the .my.cnf file has greater priority and MySQL uses the password from the file. If it does not match, restoration fails.

Also, check that you are able to connect to MySQL from the command line with:


# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa


You should not have any .my.cnf file on the /root directory. Although I tried creating a symlink to /etc/my.cnf. But it didn't made any difference. The error for the missing .my.cnf was gone but we we're still not able to finish the upgrade.

SOLUTION

We replaced the admin password to a more simplier password.

Login into the mysql server. and then run this command:

UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='admin';

and then

flush privileges;


Do not FORGET to update the /etc/psa/.psa.shadow file for the new password.

Then re-run the upgrade.

# cd /root/86/dist-rpm-CentOS-4.2-i386
# rpm -Uvh --force base/*.rpm opt/migration/*.rpm opt/backup/*.rpm


Finally, Plesk is now behaving perfectly fine! There you go. A complex problem with a really simple solution.

Hope this sheds a light to anyone out there having the same problem.

Current Mood: Fulfilled but exhausted.


You may create Service Container on a Virtuozzo hardware node using 'vzsveinstall' utility:

# vzsveinstall -D DISTRIB_DIR -s SERVICE_CT_IP

where
- DISTRIB_DIR - path to Virtuozzo distribution directory hierarchy on a server. F.e. if you have the Virtuozzo distrib on your server in the folder /root/Rel400 then DISTRIB_DIR should be /root/Rel400/;
- SERVICE_CT_IP - IP address to be assigned to Service Container;

Please refer to man page on 'vzsveinstall' utility for additional information.

Please note - OS template 'redhat-as3-minimal' must be installed on a hardware node and cached before Service Container may be created. If you have no that template on a node please do the following:
- install OS template 'redhat-as3-minimal', corresponding RPM package is located in the folder 'virtuozzo/SVE' inside Virtuozzo distrib (in Virtuozzo 3.x it is the folder 'HW/SVE');
- create OS template cache using 'vzpkgcache' command on a node.

If Virtuozzo server has been updated since the very first release (using 'vzup2date' utility or manually) then you need to apply all needed updates to the Service Container as well. Updates downloaded by 'vzup2date' utility are usually located under /vz/vzup2date/3.0.0/TU-3.0.0-* dirs on a Virtuozzo server. You may apply them to the Service Container using 'vzsveupgrade' utility using this simple script:

# for i in `find /vz/vzup2date/$(awk '{print $NF}'

If you need to re-create Service Container then you may destroy the existing one using 'vzctl destroy 1' utility (container must be stopped first), then create it from the scratches and apply available updates as it is described above.


SYMPTOMS
NAT module does not work in container, you get "can't initialize iptables table 'nat'" error:

# iptables -t nat -L -n
iptables v1.2.11: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

The following Iptables modules settings are configured on the hardware node:

# cat /proc/net/ip_tables_targets
LOG
TOS
TCPMSS
REJECT
ERROR
# grep con /etc/modprobe.conf
options ip_conntrack ip_conntrack_disable_ve0=1
RESOLUTION
If order to enable NAT you should perform the following actions on the hardware node:

- stop Virtuozzo service and all containers:

# service vz stop

- reconfigure IPtables module "ip_conntrack":

# sed -i '/ip_conntrack/ d' /etc/modprobe.conf
# echo "options ip_conntrack ip_conntrack_disable_ve0=0" >> /etc/modprobe.conf

- restart IPtables service:

# service iptables restart

- start Vituozzo service and all CTs:

# service vz start

--- http://kb.parallels.com/en/5228

After several hours of googling, and unfortunately, I'm unable to find out how to set the correct date and time on a Linux VE.

Good new is, I've tested out something that came from my mind and hey, it worked!

Here's what I did.

1. Login to the hardware node using your favorite ssh client. I used putty. It's on my downloads category.

2. I use the date command to check for the current time and date. I also used the command date to adjust the time and clock settings.

e.g. date 061913062008

That means that I want to set the date to June 19, 2008 and the current time is 13:06 or 1:00PM gmt +8.

Not that hard eh? Time to check the VE's if the changes we did to the hardware node had an effect to them. You can use the date command again in checking.

Hope this post help's you save time too.


Looking for the Centos 5.0 Livecd root password? I've spent hours looking for this one. But here you go:


12qwaszx


Ciao!

Common SSH commands

I've compiled some of the common linux/unix shell commands. I believe this will be a great jumpstart for all *nix lovers like me.

Goodluck!


cd : change directory
ex. cd /root (brings you to the /root directory)
cd .. : moves you the upper directory
ex. if you're in /root
cd .. ( brings you to the cd / directory)

cd ~ : directs you to your home directory (/home)

cd - : brings you to the last directory you were in
cat : print file contents to the screen
syntax:
cat filename.txt - this prints the contents of the file filename.txt to your screen

ls : lists all the contents of a directory including all the files/directories in it.

ls -al : shows all files,directories,including hidden ones and the details/attributes for each file
ex.
[root@localhost var]# ls -al

total 220

drwxr-xr-x 27 root root 4096 Feb 5 20:25

drwxr-xr-x 23 root root 4096 Mar 22 23:11

chmod : changes the permissions of a particular file/directory.
Syntax:
From left to right:
USER - GROUP - EVERYONE

chmod filename

0 = --- No permission

1 = --X Execute only

2 = -W- Write only

3 = -WX Write and execute

4 = R-- Read only

5 = R-X Read and execute

6 = RW- Read and write

7 = RWX Read, write and execute


ex.
chmod 755 filename - gives read,write and execute permissions on the USER and read and execute permissions only to the Group and Everyone. This will look like:

drwxr-xr-x 3 root root 4096 Sep 5 2007 filename
chown : changes the file ownership
USER GROUP
drwxr-xr-x 3 root root 4096 Sep 5 2007 filename
Syntax:
chown owner.owner filename - this sets the owner of the user and group to "owner"
chown .owner filename - this sets the owner of the group to "owner"
Ex.
chown apache:apache filename
The output would be:
From
drwxr-xr-x 3 root root 4096 Sep 5 2007 filename
It will be
drwxr-xr-x 3 apache apache 4096 Sep 5 2007 filename

du - (disk usage) displays the file space allocated to each file and directory contained in the current directory

-a, display an entry for each file (and not directory) contained in the
current directory
-H, calculate disk usage for link references specified on the command line
-k, show sizes as multiples of 1024 bytes, not 512-byte
-L, calculate disk usage for link references anywhere
-s, report only the sum of the usage in the current directory, not for each
file
-x, only traverse files and directories on the device on which the pathname
argument is specified.
-h, show filesize in nice human readable format.

This prints the summary disk space usage of the current directory.

Ok so that's it for now. I will be updating this post from time to time so be sure to bookmark the link.


Cheers!

From SWSOFT's Knowledgebase, here's a step by step information in enabling firewall in a Virtuozzo for Linux VE. (Virtual Environment)

First of all you should define which iptables modules are available for VEs.

Edit /etc/sysconfig/iptables-config and /etc/sysconfig/vz on the hardware node. Add modules you need into IPTABLES_MODULES= and IPTABLES= lines correspondingly. Please note that all iptables modules in /etc/sysconfig/vz file in IPTABLES parameter should be listed in one single line, no linebreaks are allowed in this parameter.

For example, typical firewall configuration requires the following modules:

ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp

The changes will be applied after you load all required modules and restart Virtuozzo service (all VEs will be restarted):

# service vz stop
# service iptables restart
# service vz start


Modules you defined will be available for all VEs. However, you can also define a list of iptables modules for each VE using --iptables option of vzctl utility, e.g.:

# vzctl set 101 --iptables ipt_REJECT --iptables ipt_tos --iptables ipt_TOS --iptables ipt_LOG --iptables ip_conntrack --iptables ipt_limit --iptables ipt_multiport --iptables iptable_filter --iptables iptable_mangle --iptables ipt_TCPMSS --iptables ipt_tcpmss --iptables ipt_ttl --iptables ipt_length --iptables ipt_state --iptables iptable_nat --iptables ip_nat_ftp --save


You will probably need to increase the barrier of numiptent parameter in /proc/user_beancounters using vzctl utility. This parameter limits amount of iptables rules which VE owner is allowed to create. For example, this is how you allow to enter 400 iptables rules on VE 101:

# vzctl set 101 --numiptent 400 --save

If you get this error when restarting httpd on plesk linux servers:

"Address already in use: make sock: could not bind to address 0.0.0.0:443 no listening sockets available."

Actually the error says it all.

First, try to look for the processes that is listening to port 80 or 443. You can do this:

1. netstat -lnp grep '0.0.0.0:80'
2. lsof grep *:www
3. lsof -i:443
4. fuser -v 443/tcp
5. netstat -tulpen grep :443

After pointing out which uses the port, send a kill signal:

#kill -9 PID

Replace "PID" with the actual PID.

Hope that helps.