Minggu, 02 Desember 2012

Install PhpMyadmin On Centos

1. Get the latest copy of phpMyAdmin from sourceforge
wget -c http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-english.tar.gz  /download
2. Extract the files
tar xvfz phpMyAdmin-3.4.9-english.tar.gz
3. move the extracted files to proper location
mv phpMyAdmin-3.4.9-english.tar.gz /var/www/html/phpmyadmin
4. cd /var/www/html/phpmyadmin
5. Make a copy of configuration files
cp config.sample.inc.php config.inc.php
6. Modify the values vi config.inc.php
$cfg['Servers'][$i]['auth_type']=’cookie’; to $cfg['Servers'][$i]['auth_type']=’http’;
7. Restart apache from any of command
service httpd restart – Work for me
/etc/init.d/httpd restart
8. Open browser on server
http://localhost/phpMyAdmin
You may end in following errors
1. 404 Not Found Error
Please make sure you push your phpMyAdmin directory in your webroot. In my case it’s /var/www/html
2. 403 Forbidden Error
I spend good amount of time finding why access is forbidden and finally did following setting
2.1 Go to /etc/httpd/conf.d/
2.2 vi phpMyAdmin.conf
2.3 Add following lines

Order allow,deny
Options Indexes
Allow from all
Still not able to access, try disabling the SElinux
SElinux is extra security layer in Linux and sometimes it provide conflicts for apache to work
  • vi /etc/selinux/config
  • Modify SELINUX=enforcing  to SELINUX=disabled  //Discuss with your senior. Mine is test server.
  • Restart your machine
hit http://localhost/phpMyAdmin prompt for username/password for mysql login

Source:pritisoulanki

FIX Could not chdir to home directory /root: No such file or directory Error and Solution

# mkdir /root
# chown root:root /root
# chmod 0700 /root

To create a directory called /home/vivek and set permission, type:
# mkdir /home/vivek
# chown vivek:vivek /home/vivek
# chmod 0700 /home/vivek

Try to login as vivek:
# su - vivek
Please note that you may need to adjust directory owner, group, and permissions as per your setup.

Finding more information about the user account

To fetch user account entries from administrative database (/etc/passwd and /etc/group), enter:
$ getent passwd vivek
Sample outputs:
vivek:x:1000:1000:Vivek Gite,,,:/home/vivek:/bin/bash
Where,
  1. vivek: Login name / username
  2. x : Password: An x character indicates that encrypted password is stored in /etc/shadow file.
  3. 1000: User ID (UID)
  4. 1000: The primary group ID (stored in /etc/group file)
  5. Vivek Gite: The comment field. It allow you to add extra information about the users such as user's full name, phone number etc. This field use by finger command.
  6. /home/vivek: Home directory
  7. /bin/bash: The absolute path of a command or shell (/bin/bash)
$ getent group vivek
Sample outputs:
vivek:x:1000:

Konfigurasi FTP Server Pada Centos 5.3

1. Instalasi Paket vsftpd
[root@localhost ~]# yum install vsftpd
2. Konfigurasi
[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf
Yang perlu dirubah adalah:
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to FTP Server K-Place.
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

3. Membuat user lokal dengan nama noc
[root@localhost ~]# adduser noc
[root@localhost ~]# passwd noc
Changing password for user noc.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

4. Membuat file chroot_list
File ini berisi daftar user yang bisa mengakses FTP server.
[root@localhost ~]# vim /etc/vsftpd/chroot_list
Isinya adalah :
noc
5. Restart Service FTP
[root@localhost ~]# service vsftpd restart
[root@localhost ~]# chkconfig vsftpd on

6. Cek konfigurasi FTP
[root@localhost ~]# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
allow_tftp_anon_write --> off
ftp_home_dir --> off
ftpd_disable_trans --> off
ftpd_is_daemon --> on
httpd_enable_ftp_server --> off
tftpd_disable_trans --> off

Dari hasil diatas bahwa ftp_home_dir masih berstatus off. Supaya FTP jalan maka harus diaktifkan dengan perintah :
[root@localhost]# setsebool -P ftp_home_dir on
[root@localhost]# iptables -F


Source : Binus

INSTALL LAMP on CENTOS 5.6

This article will outline the process for installing Linux, Apache, MySQL and PHP (also known as 'LAMP') on CentOS 5.6.
Getting Started
First of all, make sure your YUM repositories and packages are up to date:
# yum check-update
# yum update

Install any available package and library updates.
Apache
Next, install Apache, set it to run on startup, and finally start the service:
# yum install httpd
# chkconfig –add httpd
# service httpd start

MySQL
Installing MySQL is similar to installing Apache, except we have an additional step of running a basic setup wizard. When prompted by mysql_secure_installation, I recommend removing anonymous users, disallowing remote root logins, removing the test database and then reloading the privilege tables when prompted.
# yum install mysql-server
#chkconfig –add mysqld
#service mysqld restart
# mysql_secure_installation

PHP
Lastly, we install PHP and the PHP modules for MySQL. To install PHP 5.3 (new in CentOS 5.6), use the following:
# yum install php php-mysql
That's it, you now have a LAMP ready CentOS server.

Installing PHP 5.3 on CentOS 5.3

Firstly, you'll need to download the php-5.3 source from http://us.php.net.
Next make sure the following dependencies are installed. You can use 'yum install [package]' in order to install these:
curl-devel
freetype-devel
httpd
httpd-devel
libc-client
libc-client-devel
libjpeg-devel
libmcrypt-devel
libpng-devel
libtool-ltdl-devel
libxml2-devel
mysql-devel
Once the dependencies are installed unzip the php source with bzip2 using:
bzip2 -d php-5.3.0.tar.bz2
Next untar the files using:
tar -xvf php-5.3.0.tar
Finally change into the php-5.3 directory with:
cd php-5.3.0
Now you have to configure the installation. You may need to customize some of the settings below, but the PHP build is pretty helpful about telling you what might have gone wrong. Use the following:
./configure --with-apxs2=/usr/sbin/apxs --with-mysqli=/usr/bin/mysql_config --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/lib --with-zlib --with-freetype-dir=/usr --enable-gd-native=ttf --with-ttf --with-curl --with-aspell --enable-mbstring --with-mcrypt=/usr/local --with-mhash=/usr/local --with-libxml-dir=/usr --enable-soap --enable-zip --with-imap --with-kerberos --with-imap-ssl
Finally you need to make the installation using:
make
make install
Once PHP is built you have to create the PHP configuration file and adjust the Apache configuration files. First copy the sample php.ini configuration file using:
cp php.ini-production /usr/local/lib/php.ini
You'll probably want to link this file to its default location so you don't lose it:
ln -s /usr/local/lib/php.ini /etc/php.ini
Next, edit the httpd.conf file to include 'index.php' as one of the default indexes using:
vi /etc/httpd/conf/httpd.conf
And alter the line:
DirectoryIndex index.php index.html index.html.var
And make sure the following appears (you may need to add the second line):
LoadModule php5_module        /usr/lib/httpd/modules/libphp5.so
AddType application/x-httpd-php .php
Now that everything is configured you should be able to restart Apache using:
/etc/rc.d/init.d/httpd restart
Once this is done edit a page called phpinfo.php in the web root using:
vi /var/www/html/phpinfo.php
And include the following lines:

Now browse to the URL of the server to check the PHP configuration (for example http://localhost/phpinfo.php).


source :  madirish.net

Reset Forgotten MySQL Root Password

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.

 mysqld_safe --skip-grant-tables

 mysql --user=root mysql


update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
Now kill your running mysqld, then restart it normally. You should be good to go. Try not to forget your password again.