Hiển thị các bài đăng có nhãn Centos. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Centos. Hiển thị tất cả bài đăng

Thứ Tư, 27 tháng 4, 2016

Reset a lost password on an Ubuntu VM / CentOS VM

CentOS 6

    Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
    You will see a GRUB boot prompt telling you to press any key - you have only a few seconds to press a key to stop the automated booting process. (If you miss this prompt you will need to restart the VM again)
    At the GRUB prompt, type "a" to append to the boot command.
    Add the text "single" and press enter.
    System will boot and you will see the root prompt. Type "passwd" to change the root-password and then reboot again.
Debian, Ubuntu, CentOS 7

    Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
    As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt.
    You will see a GRUB boot prompt - press "e" to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
    Find the kernel line (starts with "linux /boot/") and add init="/bin/bash" at the end of the line (On CentOS 7, the line may start with linux16).
    Press CTRL-X or F10 to boot.
    System will boot and you will see the root prompt. Type "mount -rw -o remount /" and then "passwd" to change the root password and then reboot again.

FreeBSD

The boot menu has an option to boot into single-user mode. Press the key for single user mode (2). At the root prompt, type "passwd" to change the root password and then reboot again.
CoreOS

CoreOS by default uses SSH key authentication. On Vultr, a root user and password are created. If an SSH key is selected when creating the VPS, this SSH key can be used to login as user "core".

It is possible to reset the standard root login by executing "sudo passwd" as user "core". Login as "core" using the SSH key first.

If you lost your SSH key, then you can login as the "core" user by editing the grub loader. Follow these steps:

    Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
    You will see a GRUB boot prompt - press "e" to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
    At the end of the line that begins with "linux$" add " coreos.autologin=tty1" (no quotes).
    Press CTRL-X or F10 to boot. You will be logged in as "core" when the system boots.
    Remember to reboot your server after you have reset your login.
Read More

Thứ Tư, 11 tháng 11, 2015

CentOS / Xampp how to install mod_ruid2

CentOS / Xampp how to install mod_ruid2

1. First install its dependencies:
yum install libcap libcap-devel -y
2. Download lastest version of mod_ruid2 and unpack it
wget http://sourceforge.net/projects/mod-ruid/files/latest/download
tar xvjf mod_ruid2-0.9.8.tar.bz2
cd mod_ruid2-0.9.8
/opt/lampp/bin/apxs -a -i -l cap -c mod_ruid2.c

If it installed correctly, it should say it added a line to the httpd.conf. You can easily check if it's indeed there by the following command.
grep mod_ruid2 /opt/lampp/etc/httpd.conf

it should output something similar as

LoadModule ruid2_module       modules/mod_ruid2.so
3. Configure virtual host
vi /opt/lampp/etc/extra/httpd-vhosts.conf

<VirtualHost *:80>
...
    <IfModule mod_ruid2.c>
        RMode config
        RUidGid 10tut 10tut
    </IfModule>
</VirtualHost>

Read More

CentOS / Xampp Install PHP 5.x FCGID

CentOS / Xampp Install PHP 5.x FCGID

1. Download lastest version from apache.org and unpack.
2. Entering the extracted folder and change the file configure.aspx:
//original
if test "$APXS" = ""; then
  APXS=`which apxs 2>/dev/null`
fi;

//changed
if test "$APXS" = ""; then
  APXS=`which /opt/lampp/bin/apxs 2>/dev/null`
fi;

3. Open Terminal, stop Xampp server, navigate to the extracted folder and run the commands:
./configure.apxs
sudo make
sudo make install
4. Open file lampp/etc/extra/httpd-vhosts.conf and submit FCGID setting:
    <IfModule fcgid_module>
    FcgidInitialEnv PHPRC "/opt/lampp/etc/"
    FcgidInitialEnv SystemRoot "/"
    # FcgidInitialEnv SystemDrive "C:"
    FcgidInitialEnv TEMP "/opt/lampp/temp"
    FcgidInitialEnv TMP "/opt/lampp/temp"
    # FcgidInitialEnv windir "C:/WINDOWS"
    FcgidIOTimeout 64
    FcgidConnectTimeout 16
    FcgidMaxRequestsPerProcess 1000
    FcgidMaxProcesses 3
    FcgidMaxRequestLen 8131072
    # Location php.ini:
    # FcgidInitialEnv PHPRC "/opt/lampp/htdocs"
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

    <Files ~ "\.php$">
    Options Indexes FollowSymLinks ExecCGI
    AddHandler fcgid-script .php
    FcgidWrapper "/opt/lampp/bin/php-cgi-5.5.30" .php
    </Files>
    </IfModule>
5. Start Xampp server. Create a phpinfo.php file with the contents:
<?php phpinfo();?>
then retrieve the browser and search for the line "Find Server API". If you did everything right, the line looks approximately like this:

Server API     CGI/FastCGI

Read More

Setting Security for XAMPP CentOS 6

To make xampp secure do following.
1. Open terminal and login as root.
2. Then type in:
/opt/lampp/lampp security
XAMPP:  Quick security check...
XAMPP:  Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes]
XAMPP:  MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes]
XAMPP:  The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes]
XAMPP:  MySQL has no root passwort set!!!
XAMPP: Do you want to set a password? [yes]
XAMPP:  The FTP password for user 'daemon' is still set to 'xampp'.
XAMPP: Do you want to change the password? [yes]
XAMPP:  Done.





Read More

Thứ Ba, 10 tháng 11, 2015

Running Vhosts Under Separate UIDs/GIDs With Apache mpm-itk on Xampp

Installing apache2-mpm-itk on xampp
# wget http://mpm-itk.sesse.net/mpm-itk-2.4.7-03.tar.gz
# tar -zxvf mpm-itk-2.4.7-03.tar.gz
# cd mpm-itk-2.4.7-03
[root@10tut mpm-itk-2.4.7-03]# ./configure  --with-apxs=/opt/lampp/bin/apxs
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for cap_init in -lcap... no
checking for --with-apxs... /opt/lampp/bin/apxs
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
[root@10tut mpm-itk-2.4.7-03]#


# make && make install
...


See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /opt/lampp/modules/mpm_itk.so

[root@10tut mpm-itk-2.4.7-03]#
# vi /opt/lampp/etc/httpd.conf
...
LoadModule mpm_itk_module modules/mpm_itk.so
Configuring apache2-mpm-itk
Open vhost configuration and add the following lines to it:
[...]
<IfModule mpm_itk_module>
AssignUserId web1_user web1group
</IfModule>
[...]

Sometime vhost folder have error 403, you need to make the public_html and the files there readable by the web server.
One way is to run chmod o+x /home/user (allow everyone to switch to the home directory) and chmod -R o+rX /home/user/public_html (make public_html and files there readable by everyone).
Read More

How to install XAMPP on CentOS/RHEL 6.5

How to install XAMPP on CentOS/RHEL 6.5

XAMPP is a open source cross platform software stack package mainly used for web server solution. XAMPP is available for Windows,MAC OSX,Solaris and Linux(WAMP, MAMP, SAMP, LAMP).
XAMPP stands for –
X = Cross Platform (Windows,MAC OSX,Solaris and Linux)
A = Apache
M = MySQL
P = PHP
P = Perl

NOTE: SELINUX is in Enforcing mode

Step 1: Download the XAMPP
yum install wget
wget https://www.apachefriends.org/xampp-files/5.5.30/xampp-linux-x64-5.5.30-0-installer.run
Step 2:  Give executable permission to downloaded XAMPP script
chmod +x xampp-linux-x64-5.5.30-0-installer.run
Step 3: Run XAMPP installer script
[root@localhost src]# ./xampp-linux-x64-5.5.30-0-installer.run
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

XAMPP Core Files : Y (Cannot be edited)

XAMPP Developer Files [Y/n] :y

Is the selection above correct? [Y/n]: y

----------------------------------------------------------------------------
Installation Directory

XAMPP will be installed to /opt/lampp
Press [Enter] to continue:

----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.

Do you want to continue? [Y/n]: y

----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.

[root@localhost src]#
Step 4: Allow ALL network to access XAMPP Server
Edit the last section of file called httpd-xampp.conf. Add new line Require all granted and comment the line Require local by using # sign
vi /opt/lampp/etc/extra/httpd-xampp.conf
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    # Require local
    Require all granted
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Step 5 : Restart all services by using lampp script
Restart all the services by using below given command
/opt/lampp/lampp restart
Below given is the reference from my system
[root@localhost src]# /opt/lampp/lampp restart
Restarting XAMPP for Linux 5.5.30-0...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...ok.
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
[root@localhost src]#

Step 6: Now open the XAMPP in Web browser

Now open the web browser and type the URL or ip-address in address bar
The XAMPP dashboard will be open






Read More

Thứ Ba, 3 tháng 11, 2015

RHEL / Centos 7 Change and Set Hostname Command

RHEL / Centos 7 Change and Set Hostname Command

On a CentOS Linux 7 server you can use any one of the following tool to manage hostnames:
  1. hostnamectl command : Control the system hostname. This is recommended method.
  2. nmtui command : Control the system hostname using text user interface (TUI).
  3. nmcli command : Control the system hostname using CLI part of NetworkManager.

Method #1: hostnamectl command

Let us see how to use the hostnamectl command.
$ hostnamectl

## OR ##
$ hostnamectl status
Sample outputs:
   Static hostname: centos-7-vm
         Icon name: computer
           Chassis: n/a
        Machine ID: 663f697442a7d2c736c892230000002f
           Boot ID: c1ab056f60170cc0c9b63e1d1ea9c8fb
    Virtualization: oracle
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-229.1.2.el7.x86_64
      Architecture: x86_64


How do I set the host name?
The syntax is:
# hostnamectl set-hostname Your-New-Host-Name-Here
# hostnamectl set-hostname "Your New Host Name Here" --pretty
# hostnamectl set-hostname Your-New-Host-Name-Here --static
# hostnamectl set-hostname Your-New-Host-Name-Here --transient
To verify new settings, enter:
# hostnamectl status
How do I delete a particular host name?
The syntax is:
# hostnamectl set-hostname ""
# hostnamectl set-hostname "" --static
# hostnamectl set-hostname "" --pretty

Method #2: nmtui command

You can set host name using nmtui command which has text user interface for new users:
# nmtui
Use the Down arrow key > select the "Set system hostname" menu option > Press the "Ok" button
Finally, restart hostnamed service by typing the following command
# systemctl restart systemd-hostnamed
To verify new hostname, enter:
# hostnamectl status

Method #3: nmcli command

To view the host name using nmcli command:
The syntax is:
# nmcli general hostname
To set the host name using nmcli command:
The syntax is:
# nmcli general hostname 10tut
# nmcli general hostname 10tut.localdomain
Finally, restart the systemd-hostnamed service:
# systemctl restart systemd-hostnamed
check cat /etc/sysconfig/network /etc/hostname

Read More

How Do I Find My Linux Gateway / Router IP Address

How Do I Find My Linux Gateway / Router IP Address

[1] Find out Gateway / router IP address under Linux / UNIX using route command
    You need to use route command. This command can manipulates the kernel’s IP routing tables.
$ route -n
Output:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.1 is gateway IP address for our computer. The flag U indicates that route is up and G indicates that it is gateway. You can print gateway name, enter:

[2] Find out Gateway / router IP address under Linux / UNIX using netstat command
Open a terminal and type the following command:
# netstat -r -n
Sample outputs:
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1   0.0.0.0         UG        0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0



Read More

Set Hostname on CentOS

Set Hostname on CentOS

Change and Set Hostname Command for RHEL / Centos 7 , refer to here

Step 1: Login to your CentOS Server

Locate the IP address of your Server and login as the root user.

ssh root@server

Step 2: Use the hostname utility

Change your hostname to a different name of your choosing. For example:

hostname 10tut.localdomain
Step 3: Edit /etc/hosts

Open the /etc/hosts file with your favorite text editor. For example:

nano /etc/hosts

Change the first line and replace your old hostname with the new one. Save the file and exit the editor.

Step 4: Edit /etc/sysconfig/network

This file also contains your hostname. Open the /etc/sysconfig/network file with your favorite text editor.

Change HOSTNAME=localhost to your desired hostname. For example: HOSTNAME=10tut.localdomain

Step 5: Check your hostname

Run the following command to check your new hostname:

hostname

The new hostname will be displayed in your ssh terminal.
Read More

Thứ Hai, 2 tháng 11, 2015

Booting into a Graphical Environment

Booting into a Graphical Environment

If you have installed the X Window System but are not seeing a graphical desktop environment once you log into your Red Hat Enterprise Linux system, you can start the X Window System graphical interface using the command startx.
Once you enter this command and press Enter, the graphical desktop environment is displayed.
 
Note, however, that this is just a one-time fix and does not change the log in process for future log ins. 

To set up your system so that you can log in at a graphical login screen, you must edit one file, /etc/inittab, by changing just one number in the runlevel section. When you are finished, reboot the computer. The next time you log in, you are presented with a graphical login prompt.
Open a shell prompt. If you are in your user account, become root by typing the su command.
Now, type gedit /etc/inittab to edit the file with gedit. The file /etc/inittab opens. Within the first screen, a section of the file which looks like the following appears:
# Default runlevel. The runlevels used by RHS are: 
#   0 - halt (Do NOT set initdefault to this) 
#   1 - Single user mode 
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking) 
#   3 - Full multiuser mode 
#   4 - unused 
#   5 - X11 
#   6 - reboot (Do NOT set initdefault to this) 
#  id:3:initdefault:
 To change from a console to a graphical login, you should change the number in the line id:3:initdefault: from a 3 to a 5.

When you are satisfied with your change, save and exit the file using the Ctrl-Q keys. A window appears and asks if you would like to save the changes. Click Save.
The next time you log in after rebooting your system, you are presented with a graphical login prompt.


 


Read More

Install Xrdp Server

Install Xrdp Server

Install Xrdp server to connect to CentOS from Windows clients with the Remote Desktop function. 
[1] Install Xrdp server and start it. 
# install from EPEL

[root@dlp ~]# yum --enablerepo=epel -y install xrdp tigervnc-server
[root@dlp ~]# /etc/rc.d/init.d/xrdp start

Starting xrdp:                       [  OK  ]
Starting xrdp-sesman:                [  OK  ]

[root@dlp ~]# chkconfig xrdp on 
[2] Connect from Windows clients. For example on Windows 7, input "mstsc" to start the remote desktop function. 
[3] Input the hostname or IP address you'd like to connect and push the "Connect" button.
[4] Answer with "Yes". 
[5] Input a user which is in CentOS to authenticate.
[6] Just connected. If failed to login at first time (sometimes happens at first login), retry to login again.
Read More

How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x

How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x

What is EPEL

EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux.

Why we use EPEL repository? 

  1. Provides lots of open source packages to install via Yum.
  2. Epel repo is 100% open source and free to use.
  3. It does not provide any core duplicate packages and no compatibility issues.
  4. All epel packages are maintained by Fedora repo

How To Enable EPEL Repository in RHEL/CentOS 7/6/5?

First, you need to download the file using Wget and then install it using RPM on your system to enable the EPEL repository. Use below links based on your Linux OS versions. (Make sure you must be root user).

RHEL/CentOS 7 64 Bit

## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -ivh epel-release-7-5.noarch.rpm

RHEL/CentOS 6 32-64 Bit

## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

RHEL/CentOS 5 32-64 Bit

## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm

## RHEL/CentOS 5 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm

RHEL/CentOS 4 32-64 Bit

## RHEL/CentOS 4 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm

## RHEL/CentOS 4 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/x86_64/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm

How Do I Use EPEL Repo?

You need to use YUM command for searching and installing packages. For example we search for Zabbix package using epel repo, lets see it is available or not under epel.
# yum --enablerepo=epel info zabbix
Let’s install Zabbix package using epel repo option –enablerepo=epel switch.
# yum --enablerepo=epel install zabbix
From: tecmint[.]com

 



Read More

Chủ Nhật, 3 tháng 5, 2015

Install python easy_install via yum on Linux CentOS Server

To install easy_install on Linux using yum you will need to install the python-setuptools and python-setuptools-devel packages. Installing these packages with yum is easy by following the directions below.

Both of these packages were installed using the Atomic repository.

Yum Command To Install python-setuptools:
yum install python-setuptools

An example of a python-setuptools install is below.

Example Of python-setuptools Being Installed:
[root@server ~]# yum install python-setuptools
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: pubmirrors.reflected.net
* updates: mirrors.serveraxis.net
* addons: mirror.anl.gov
* ruby: repo.premiumhelp.eu
* extras: mirror.sanctuaryhost.com
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package python-setuptools.noarch 0:0.6c5-2.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
python-setuptools noarch 0.6c9-2.el5 base 479 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 479 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): python-setuptools- 100% |=========================| 479 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: python-setuptools ######################### [1/1]

Installed: python-setuptools.noarch 0:0.6c5-2.el5
Complete!

You will also need to install python-setuptools-devel as displayed below.

Yum Command To Install python-setuptools-devel:
yum install python-setuptools-devel

An example of python-setuptools-devel being displayed is below.

Example Of python-setuptools-devel Being Installed:
[root@server ~]# yum install python-setuptools-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* atomic: www.atomicorp.com
* rpmforge: ftp-stud.fht-esslingen.de
* base: mira.sunsite.utk.edu
* updates: dist1.800hosting.com
* addons: www.cyberuse.com
* extras: pubmirrors.reflected.net
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package python-setuptools-devel.noarch 0:0.6c9-2.el5.art set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
python-setuptools-devel noarch 0.6c9-2.el5.art atomic 41 k

Transaction Summary
====================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 41 k
Is this ok [y/N]: y
Downloading Packages:
python-setuptools-devel-0.6c9-2.el5.art.noarch.rpm | 41 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-setuptools-devel [1/1]

Installed: python-setuptools-devel.noarch 0:0.6c9-2.el5.art
Complete!
Read More

Thứ Tư, 26 tháng 3, 2014

Delete IPTables Rules By Line Number

Delete IPTables Rules By Line Number

First off list all IPTable's rules by chain number:
iptables -vnL --line-numbers
Then delete the line you want:
iptables -D INPUT 22
This will delete chain line number 22
Read More

Thứ Tư, 12 tháng 3, 2014

Update PHP 5.3 for Kloxo

Update PHP 5.3 for Kloxo

You can follow the steps below to update your php version to 5.3  for Kloxo.

Install repository

Creat file /etc/yum.repos.d/ius.repo

[ius]
name=IUS Community Packages for Enterprise Linux 5 - $basearch
baseurl=http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/$basearch
enabled=1
gpgcheck=0

Creat file /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
enabled=1
gpgcheck=0
exclude=nginx*

Install yum replace 

yum install yum-plugin-replace
Replace php with php53u
yum replace php --replace-with=php53u
 * Other way: remove php and install php53u
yum -y remove php php-common
yum -y install php53u php53u-cli php53u-devel php53u-gd php53u-imap php53u-mbstring php53u-mysql php53u-pdo php53u-pear php53u-xml
 Create a php.ini template for php5.3
# cp /usr/local/lxlabs/kloxo/file/phpini/php.ini.template-5.2 /usr/local/lxlabs/kloxo/file/phpini/php.ini.template-5.3
# chown -R lxlabs:lxlabs /usr/local/lxlabs/kloxo/file/phpini/php.ini.template-5.3
Verify the new PHP version.
# php -v
Read More

Chủ Nhật, 23 tháng 2, 2014

Cpanel Restart Services

Cpanel Restart Services

 By default, you may restart the following services via WHM:
  •     DNS nameserver (named/BIND or NSD)
  •     FTP Server (ProFTPd or Pure-FTPd)
  •     HTTP web server (Apache/httpd)
  •     POP3/IMAP email server (Courier or Dovecot)
  •     POP3 server (cPPOP)
  •     Mail server (Exim)
  •     SQL server (MySQL)
  •     SSH server (openSSH)
Restarting a service will not work if the service is stopped. If you wish to start or stop a service, refer to the Service Manager feature in WHM.

To restart a service:
  •     On the main Restart Services screen, select the service you wish to restart.
  •     When asked whether you wish to restart the service, click Yes. 

Restart from the command line 

Important: If you use IPv6, the service network restart command will remove the IPv6 addresses from the network device. To restart your IPv6 configuration, you must run the /etc/init.d/cpipv6 restart command after you restart the network service.

exim mail transfer agent (mta). /usr/local/cpanel/scripts/restartsrv exim
bind nameserver daemon. /usr/local/cpanel/scripts/restartsrv named
proftp ftp server daemon. /usr/local/cpanel/scripts/restartsrv proftpd
pure-ftp ftp server daemon. /usr/local/cpanel/scripts/restartsrv pureftpd
apache web server daemon. /usr/local/cpanel/scripts/restartsrv httpd
courier mail server daemon. /usr/local/cpanel/scripts/restartsrv courier
dovecot mail server daemon. /usr/local/cpanel/scripts/restartsrv dovecot
system logs daemon. /usr/local/cpanel/scripts/restartsrv syslogd
clam antivirus software daemon. /usr/local/cpanel/scripts/restartsrv clamd
secure shell (ssh) daemon /usr/local/cpanel/scripts/restartsrv sshd
common unix superserver daemon responsible for managing internet services. /usr/local/cpanel/scripts/restartsrv inetd
cpanel’s version of pop3 mail downloading service. similar to imap. /usr/local/cpanel/scripts/restartsrv cppop
imap mail downloading service. similar to pop3. /usr/local/cpanel/scripts/restartsrv imapd
mysql database server. /usr/local/cpanel/scripts/restartsrv mysql
postgresql database server. /usr/local/cpanel/scripts/restartsrv postgresql
interchange e-commerce server. /usr/local/cpanel/scripts/restartsrv interchange
java servlet container and http server. /usr/local/cpanel/scripts/restartsrv tomcat
chat service. /usr/local/cpanel/scripts/restartsrv entropychat

Restart directly from the command line
 If this does not work, you can attempt to restart the service directly. The location of the service depends upon your operating system; however, for many distributions, services are located in the /etc/init.d/ directory.

 

Read More

Thứ Năm, 24 tháng 10, 2013

What are Core Dumps?

What are Core Dumps?

Core dumps are files the system creates when a process running in memory does not finish. The portion of memory that the process was using is then dumped to a file. This can be quite helpful when debugging your scripts. Core dumps typically have a file name like: core.5876
Reviewing Core Dump Files on VPS or Dedicated Servers

For most users, getting usable information from a core dump file can be difficult. If you are a VPS or Dedicated customer with command line (shell) access, most of the information in the core dump can be found by running either one of these two commands:

gbd -c core.####

strings core.####
Reviewing Core Dump Files on Shared Servers

If you are on a shared hosting package, for security reasons you do not have access to the command line. For our shared customers, we've created a basic PHP script that uses the commands above to allow you to find any core dump files in your account. The script can be found here:

http://inmotionhosting.com/support/files/scripts/coredumpcheck.txt

    Upload the coredumpcheck.txt file to the folder where you want to view core dumps.
    Rename the file to coredumpcheck.php
    Access coredumpcheck.php file in your browser. For example, if you have core dumps in your public_html folder then you would go to http://yourdomain.com/coredumpcheck.php
    The script will list all the core dumps in the current directory. Click any of the file names to view more details about the core dump.
    Look under the "RUNNING: gdb -c core.30387" heading to find the script that is causing the problem. It will look something like:

    Core was generated by '/usr/bin/php /home/training/public_html/t2c_escalation/escalatet2s.php'.


Resolving Core Dumps

Core dumps are advanced in nature. It's best practice to contact your web developer with the information that you have using the coredumpcheck.php script. If you are using a CMS such as WordPress, Joomla, or Drupal and the core dump is being caused by a plugin or module, your can disable or remove that module to resolve the issue.
Read More

Thứ Năm, 30 tháng 5, 2013

PHP FCGI


A default installation of FastCGI on cPanel server is dangerously simple. It’s dangerous because one cPanel account (or one vhost) is capable of crashing down a whole server if, say, traffic were to spike up. It’s also simple because it won’t allow complex scripts to run cleanly. In brief, it’s absolutely not ready for production as-is. In this post, I’ll go over what it takes to configure FastCGI on a cPanel node properly.
The following is a list of settings that you need to add to /etc/httpd/conf/php.conf upon switching to FastCGI:
MaxRequestsPerProcess 1000
FcgidMaxProcesses 200
FcgidProcessLifeTime 7200
MaxProcessCount 500
FcgidIOTimeout 400
FcgidIdleTimeout 600
FcgidIdleScanInterval 90
FcgidBusyTimeout 300
FcgidBusyScanInterval 80
ErrorScanInterval 3
ZombieScanInterval 3
DefaultMinClassProcessCount 0
DefaultMaxClassProcessCount 3
MaxRequestLen 20468982
You’re more likely to adjust the settings in bold above. DefaultMinClassProcessCount 0 instructs FastCGI to keep zero PHP processes running for user when traffic is idle (cPanel account user) . On the other hand, DefaultMaxClassProcessCount 3 tells FastCGI to never allow more than 3 PHP processes running at a time. This settings prevents one users from crashing the server were they to receive a lot of traffic.
So go ahead and copy/paste the above into your httpd.conf and restart Apache (service httpd restart). You’re good to go now!
Distill and rebuild Apache, then restart Apache
root@server[#] /usr/local/cpanel/bin/apache_conf_distiller --update
root@server[#] /scripts/rebuildhttpdconf
root@server[#] /etc/init.d/httpd restart

/etc/httpd/conf/php.conf

# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 500
DefaultMinClassProcessCount 0
DefaultMaxClassProcessCount 2
MaxRequestLen 204689820
FcgidConnectTimeout 150
FcgidIdleScanInterval 90
FcgidIOTimeout 150
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml
Read More

Thứ Hai, 15 tháng 4, 2013

Exim Remove All messages From the Mail Queue

Question:

 I'm using Exim mail server under CentOS Linux. How do I remove all messages from the Exim mail queue using a shell prompt?

Answer:
Exim is a mail transfer agent (MTA) used on Unix-like operating systems. It aims to be a general and flexible mailer with extensive facilities for checking incoming e-mail.

To print a list of the messages in the queue, enter:

# exim -bp

To remove a message from the queue, enter:

# exim -Mrm {message-id}

To remove all messages from the queue, enter:

# exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
Dallas Marlow, suggested following clean command:
# exim -bp | exiqgrep -i | xargs exim -Mrm
DELETE FROZEN MAILS
/usr/sbin/exim -bp | awk '$6~"frozen" { print $3 }' | xargs /usr/sbin/exim -Mrm
REMOVE MAILS FROM SENDER
/usr/sbin/exiqgrep -i -f (MAIL ADDRESS HERE) | xargs /usr/sbin/exim -Mrm 
OR 
/usr/sbin/exim -bp | awk '$4~"info@domain.com" { print $3 }' | xargs /usr/sbin/exim -Mrm


Read More

How to block emails from a specific address using Exim

Issue :
How to block emails from a specific address on a cPanel/WHM server using Exim ?
Solution :
This is fairly easy to achieve with Exim.
First you’ll need to find the system filter file for Exim. This can be found out through WHM >> Main >> Service Configuration >> Exim Configuration Editor.
Towards the middle of the page, under the section ‘Filters’ , you ‘ll find the path to the file.
Open that file via SSH using your favorite editor and add the following to it :
if first_delivery
and ( (“$h_from:” contains “emailtoblock@domainname.com”)
)
then fail
endif
Read More