MySQL command

Posted January 12th, 2009 by marslert

Create mysql user with password :

# mysql

# create user wpuser identified by ‘wppass’;

Note : wpuser is the mysql username and follow by wppass is the mysql user password.

Grant privileges to mysql db :

# grant all privileges on wordpress.* to ‘wpuser’@'localhost’ identified by ‘wppass’;

Check privileges :

show grants for ‘wpuser’@'localhost’;
+————————————————————————————–+
| Grants for wpuser@localhost                                                          |
+————————————————————————————–+
| GRANT USAGE ON *.* TO ‘wpuser’@'localhost’ IDENTIFIED BY PASSWORD ’7171e928058581f3′ |
| GRANT ALL PRIVILEGES ON `wordpress`.* TO ‘wpuser’@'localhost’                        |
+————————————————————————————–+
2 rows in set (0.01 sec)

cannot run apxs

Posted January 12th, 2009 by marslert

The error faced when compiling PHP module to Apache2.

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using –with-apxs2=/path/to/apxs
3. Apache was not built using –enable-so (the apxs usage page is displayed)

The output of /usr/local/apache/bin/apxs follows:
./configure: /usr/local/apache/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory
configure: error: Aborting

Replace first line of /usr/local/apache/bin/apxs from,

#!/replace/with/path/to/perl/interpreter

with

#!/usr/bin/perl -w

chkconfig

Posted January 12th, 2009 by marslert

Learn some chkconfig command today. This command is used to maintain the /etc/rc[0-6].d directory hierarchy.

First of all, lets understand and differentiate some of the /etc/rc[0-6].d .

rc1.d >>> Single user mode

rc2.d >>> Custom user mode

rc3.d >>>Multiple user mode with networking availability

rc4.d >>> Custom user mode

rc5.d >>> Multiple user mode with networking availability that has GUI mode (xlogin)

# chkconfig –list
haldaemon       0:off   1:off   2:off   3:on    4:on    5:on    6:off
httpd           0:off   1:off   2:off   3:on    4:off   5:off   6:off
ip6tables       0:off   1:off   2:on    3:on    4:on    5:on    6:off
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
kudzu           0:off   1:off   2:off   3:on    4:on    5:on    6:off
lvm2-monitor    0:off   1:on    2:on    3:on    4:on    5:on    6:off
mcstrans        0:off   1:off   2:on    3:on    4:on    5:on    6:off
messagebus      0:off   1:off   2:off   3:on    4:on    5:on    6:off
multipathd      0:off   1:off   2:off   3:off   4:off   5:off   6:off
mysqld          0:off   1:off   2:off   3:off    4:off   5:off   6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
netplugd        0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
rdisc           0:off   1:off   2:off   3:off   4:off   5:off   6:off
restorecond     0:off   1:off   2:on    3:on    4:on    5:on    6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off

Now, mysqld service was set to off for rc3.d . We are going to On it in rc3.d level with below command.

# chkconfig –levels 3 mysqld on

Will see S64mysqld in /etc/rc3.d in my case. I see K36mysqld when levels 3 was off in my case.

Manually install pureftp

Posted January 12th, 2009 by marslert

Before install pureftp, I am going to show how to manually create a linux user, linux group and assign the user to grou[.

Add user:

# useradd ftpuser

Check user:

# less /etc/passwd

ftpuser:x:500:500::/home/ftpuser:/bin/bash

Add group:

# groupadd ftpgroup

Check group:

# less /etc/group

ftpgroup:x:500:

Assign user to group:

# vi /etc/group

change ftpgroup:x:500: to ftpgroup:x:500:ftpuser

Install pureftp:

  1. Download pureftp installation file from ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/ .
  2. Extract the installation file at any directory.
  3. Run ./configure –with-everything –with-paranoidmsg –without-capabilities -with-virtualchroot
  4. Run make & make install
  5. Done

Copy pureftp configuration to /etc :

# cp pure-ftpd-1.0.21/configuration-file/pure-ftpd.conf /etc

Copy pureftp startup script to /usr/local/sbin/ :

# cp pure-ftpd-1.0.21/configuration-file/pure-config.pl /usr/local/sbin/

Create a ftp user :

# pure-pw useradd test -u ftpuser -d /home/directoryname

  • useradd > option of pure-pw
  • test > the ftp username
  • -u > linux username
  • ftpuser > the linux user that created
  • -d > path to the upload directory
  • /home/directoryname > path name

Show ftp user detail :

# pure-pw show test

Output :

Login              : test
Password           : $1$h8ZLTun0$iYCeCgrYfMz0BrbLC/6Ca1
UID                : 500 (ftpuser)
GID                : 500 (ftpgroup)
Directory          : /home/directory/./
Full name          :
Download bandwidth : 0 Kb (unlimited)
Upload   bandwidth : 0 Kb (unlimited)
Max files          : 0 (unlimited)
Max size           : 0 Mb (unlimited)
Ratio              : 0:0 (unlimited:unlimited)
Allowed local  IPs :
Denied  local  IPs :
Allowed client IPs :
Denied  client IPs :
Time restrictions  : 0000-0000 (unlimited)
Max sim sessions   : 0 (unlimited)

Check ftp user option :

# pure-pw usermod test -h

Ftp user option normally stored in /etc/pureftpd.passwd . You will something like below when open this file.

test:$1$vrb6.MK0$/shIogHo4RVvQXr8bJSBe/:500:500::/home/directory/::::::::::::

Generate ftp database :

# pure-pw mkdb

The ftp database file will be created at /etc and named pureftpd.pdb .

Un-comment PureDB & AltLog varialble that store in /etc/pure-ftpd.conf .

Now, we can start the ftp service

# /usr/local/sbin/pure-config.pl /etc/pure-ftpd.conf

Done !!! Pureftp is installed. May try to connect to the ftp service via ftp client or ftp command.

dhclient eth0

Posted December 18th, 2008 by marslert

A sweet command learned from a senior for retrieving a new IP from a bridged or NAT network.

Useful when working in some virtual OS to retrieve IP.

Even you can kill the process of dhclient if there is problem for retrieving new IP.

First of all, run

ps aux | grep dhclient

to grab the PID and kill it. After that, execute again dhclient eth0.

cannot restore segment prot after reloc: Permission denied

Posted December 18th, 2008 by marslert

Met this problem when I was compiling PHP5 for my testing virtual centos. Gotto temporary disable it by executing command,

/usr/sbin/setenforce 0

Select the default Ubuntu Display Manager

Posted December 18th, 2008 by marslert

If you have one day installed any other Display Manager to your Ubuntu, set it as default DM and do not know how to revert the original DM > GNOME, you should execute below command which will solve your problem

sudo dpkg-reconfigure gdm

I experienced this caused I installed KDE to my system :)

The problem happened when I could not start the Apache service when the production server was overloading.

root@servername [~]# service httpd start

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

Unable to open logs

Lets run the netstat to check the Apache process is hook up with which other process.

root@servername [~]# netstat -lnp | grep ’0.0.0.0:80′

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      22666/exim

Next, run the ps command to check above listening process

root@servername [~]# ps 22666

PID TTY      STAT   TIME COMMAND

22666 ?        S<s    0:00 /usr/sbin/exim -Mc 1L5ryZ-0005tZ-T0

GotYa. Is confirmed that Apache process could not stop due to Exim process.

Run the service reboot command to Exim service. Give a shoot by restarting Exim and then start Apache will wake up your Apache service.

Note : This is an example situation which it does not really relates to Exim process. It could be other process. Do check with netstat command and you will find out.

 

 

HELM Version 3.2.18 File Manager problem

Posted November 19th, 2008 by marslert

Problem occur when you cant see any files/folders of your website under HELM3 File Manager.

Solution : Enable Server Services

Description : Supports file, print, and named-pipe sharing over the network for this computer. If this service is stopped, these functions will be unavailable. If this service is disabled, any services that explicitly depend on it will fail to start.

It happened when trying to surf a directory under IIS7 environment that contains special character symbol and return you HTTP 404.11-Not Found error.

Example Url : http://localhost/directory/A+B+C/filename.html
 

By default, IIS 7.0 rejects URLs that contain a double escape sequence.

WorkAround

1. Open web.config and add

<system.webServer>
		<security>
			<requestFiltering allowDoubleEscaping="True"/>
		</security>
	</system.webServer>
</configuration>

2. Save