OUR CATEGORY : CentOS/RHEL
Xampp for linux is an easy to install Apache distribution containing MySQL, PHP and Perl. Xampp contain a package of Apache 2.2.4, MySQL 5.0.45, PHP 5.2.3 & 4.4.7 & PEAR + SQLite 2.8.17/3.3.17 + multibyte (mbstring) support, Perl 5.8.7, ProFTPD 1.3.0a, phpMyAdmin 2.10.3, OpenSSL 0.9.8e, GD 2.0.1, Freetype2 2.1.7, libjpeg 6b, libpng 1.2.12, gdbm 1.8.0, zlib 1.2.3, expat 1.2, Sablotron 1.0, libxml 2.4.26, Ming 0.3, Webalizer 2.01, pdf class 009e, ncurses 5.8, mod_perl 2.0.2, FreeTDS 0.63, gettext 0.11.5, IMAP C-Client 2004e, OpenLDAP (client) 2.3.11, mcrypt 2.5.7, mhash 0.8.18, eAccelerator 0.9.5.1, cURL 7.13.1, libxslt 1.1.8, phpSQLiteAdmin 0.2, libapreq 2.07, FPDF 1.53, XAMPP Control Panel 0.6.
But Xampp is not meant for production use but only for developers in a development environment, and have a list of missing security :
1. The MySQL administrator (root) has no password.
2. The MySQL daemon is accessible via network.
3. ProFTPD uses the password “lampp” for user “nobody”.
4. PhpMyAdmin is accessible via network.
5. Examples are accessible via network.
6. MySQL and Apache running under the same user (nobody).
Xampp is not recommended for an online (dedicated or shared) server.
Remove Xampp (if you already have a Xampp)
Stop then remove
# /opt/lampp/lampp stop
# rm -rf /opt/lampp
Plesk have DNS Zone template to setup DNS Zone when you create a domain.
DNS Zone template located in System > Server Administration > Services > DNS.
. NS ns.. . A . MX (10) mail.. / 24 PTR . ftp.. CNAME . mail.. A ns.. A webmail.. A
DNS Zone Template only have one ns (nameserver) by default. Changes template for 2 nameserver, for example
. NS ns1.. . NS ns2.. . A . MX (10) mail.. / 24 PTR . ftp.. CNAME . mail.. A ns1.. A ns2.. A webmail.. A
DNS Zone can be seen in General > Domains > Domain Name > DNS. If you want to change values, just do it in a domain DNS Zone, not in DNS Zone template.
Chrooted DNS doesn’t work with Plesk. That’s why chrooted DNS must remove from CentOS after Plesk installation. Plesk have its own DNS. It’s better not to install chrooted DNS in CentOS, if you are using Plesk
Remove Chrooted DNS
# rpm -e bind-chroot
Chrooted DNS make DNS service in Plesk looks failed, but it’s not (Server > Service Management > DNS Server (Bind)).
Setup Plesk DNS manually.
DNS files is in /var/named, /var/named/run-root/etc, /var/named/run-root/var/named, /var/named/run-root/var directory.
In this case, /var/named and /var/named/run-root/var/named directory have same content (below), except file named.pid in /var/named :
localdomain.zone
localhost.zone
named.broadcast
named.ca
named.ip6.local
named.local
named.zero
DNS configuration (named.conf) in /var/named/run-root/etc must same�with rndc-key , for example :
# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "CeMgS23y0oWE20nyv0x40Q==";
};options {
default-key "rndc-key";
default-server 127.0.0.1;
# default-port 953;
};
# End of rndc.conf# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "CeMgS23y0oWE20nyv0x40Q==";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };
Generate rndc-key
# rndc-confgen
Generate rndc-keyStop/Start/Restart BIND
# /etc/init.d/named stop
# /etc/init.d/named start
# /etc/init.d/named restart
Meanwhile, Plesk DNS Zone is in /var/named/run-root/var. Setup Plesk DNS Zone using Plesk Administration Site
Related Topics
Setup Plesk DNS Zone
A few days a go, i was asked to fix date and time in one of servers. The date and the time between Linux Kernel system time and hardware wasn’t properly set up. And when i tried ntpd, it was failed (i’m still trying to figure out why).
Timezone configuration is correct. So i don’t need to worry about timezone, which is in UTC.
The problem is the date correct, but the time in Linux Kernel system time and hardware clock aren’t match at all. There are about +7 hours different with the correct UTC time in a Linux Kernel time system, and -7 hours different with the correct UTC time in a hardware clock.
Set up date and time :
Display the time and date
# date
Display UTC
# date --utc
Display current hardware clock time
# hwclock --show
Since the time in Linux Kernel time doesn’t match with the current time
# date -s "18:56:00"
Set the hardware clock from the system clock (kept by the Linux kernel)
# hwclock --systohc
Here is a way to setup IP in CentOS without Plesk
Let’s assume the network interface is eth0. Then there is a file /etc/sysconfig/network-scripts/ifcfg-eth0. This is an eth0 file configuration.
Use vi or other text editor
# vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:0C:29:C8:AA:7C
IPADDR=192.168.0.19
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
Create Virtual Interface
Create the virtual interface eth0:0 with the IP address 192.168.0.20. Just create the file /etc/sysconfig/network-scripts/ifcfg-eth0:0 (leave out the HWADDR line as it is the same physical network card):
Use vi or other text editor
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.20
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
Restart the network
/etc/init.d/network restart
Setup/Add IP in Plesk is quite simple :
1. Sign On to Plesk Administration Site
2. Choose Server in System Menu (reside in left bar)
3. Choose IP Addresses in System
4. Choose New IP Addresses in IP Adresses management, plesk will show ‘IP Address form’ :
- leave out interface to eth0 (eth0 is a default. If there’s another interface/ethernet card in the system, choose other using a drop down menu)
- fill in an ip address and a subnet mask with to-be ip address and subnet mask
- choose an ip type, shared ip type means that one ip address can be used by one or more domain, exclusive means that one ip address can only be used by one domain
- leave out SSL certificate to a default certificate
- choose OK
Note : Plesk has a based IP already, which is set up in the installation process, do not change this, unless you need to change it. This additional IP can be use as a name server, or an alternative IP for a domain hosted in server
Change IP address :
Using Reconfigurator utility.
This utility allows you to change IPs in Plesk based and reconfigure domain settings with new IPs.
Plesk root directory usually in /usr/local/psa
$Plesk_ROOT_D/bin/reconfigurator.pl
The new IP addresses must NOT exist in Server > IP Addresses list in Plesk control panel before replacement, they may be added on system level only. If IP addresses do not exist in the system, the utility will add new IPs to the system as well.
Instruction :
1 Run the command to create a template file.
2. Edit the file to set an appropriate IP mapping
3. Run the command (number 1) once again.
Map File
The map file will contain the list of your current IP addresses of the
following format, e.g:
eth0:192.168.15.01 255.255.255.0 -> eth0:192.168.15.01 255.255.255.0
Edit the file with to-be IP addresses (please, note that to-be ones come on the right of an arrow sign),e g
eth0:192.168.15.01 255.255.255.0 -> eth0:your_ip_address_to_be 255.255.255.0
For example:
1. $PLESK_ROOT_D/bin/reconfigurator.pl ip_map.txt
2. Modify ip_map.txt file
3. $PLESK_ROOT_D/bin/reconfigurator.pl ip_map.txt
Manual IP Change
IP Setting is saved in /etc/sysconfig/network-scripts directory with ifcfg-eth0 as a configuration file for eth0 interface. This eth0 interface configuration has been set up at centos installation
Open using vi or other text editor
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
If ip address is setup using Plesk Administration site and using same eth0 as a interface (virtual interface), the configuration file will be saved in ifcfg-eth0:1. If base ip in ifcfg-eth0, second ip with same interface will be in ifcfg-eth0:1, and third or fourth, so on will be in ifcfg-eth0:x.
Open using vi or other text editor
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:2
Change ip address and subnet mask with to-be ip address
Restart the Network
# /etc/init.d/network restart
Log On to Plesk Administration Site
1. Choose Server in System Menu (reside in left bar)
2. Choose IP Addresses in System
3. Choose Re-read IP in IP Addresses Management
We’re running AutoInstaller from Plesk Site.
But before going through that phase, we should change redhat-release content in etc directory
[root@ ~] vi /etc/redhat-release
You’ll see in a redhat-release file, CentOS release 4.4 (Final). Change it to RedHat Enterprise Linux 4
RedHat Enterprise Linux 4
~
~
~
"/etc/redhat-release" 1L, 26C
Run AutoInstaller
Go to where Plesk AutoInstaller reside, e.g root (~) directory, then
# ./psa_redhat
Follow Plesk AutoInstaller instructions
- Set plesk directory,for example /root/psa or /tmp/psa. Plesk directory is a place for keeping software packages, needed by installation.
- Set plesk source to Plesk Site. I suggest Plesk Site as a source, since AutoInstaller need to download software packages. Except if you’re already download all of software packages, and if you get some problem in the end of installation, you can set to Local Source
- Huge download around 100 MB. I suggest reliable Internet Connection
- Choose whatever packages you need for your Plesk Administration in Package Selection. If you want base PSA/Centos Installation, you can desellect all. By Default, Plesk sellect all packages. I have problem with tomcat package, they need a gpg key, which i can’t find anywhere. So i don’t include tomcat package in my selections. Tomcat package isn’t essential, you can deselect them
- Plesk will download software packages and install them for you. If you have a problem, look at installation logs
- Try open Plesk Administrator Site in your browser. You will be asking for license agreement, then domain name, default ip, e-mail, and finally…Finished
MySQL, is one of important databases today. Most web server has it.
And you will want to monitor MySQL activity, to see what queries a server is currently processing as well as which user is executing them
MyTop is ‘top’ clone for mysql, a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL.
Installation (centOS/RHEL)
1. Look for gcc and gcc-c++ software packages in your system, this is essential for mytop.
# rpm -qa gcc
# rpm -qa gcc-c++
If�the packages found, go to step number 2. If the packages not found, please run this
# yum install gcc
# yum install gcc-c++
2. Install TermReadKey
go to usr/local/src directory
# cd /usr/local/src
# wget http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz
# tar -zxvf TermReadKey-2.30.tar.gz
# cd TermReadKey-2.30
# perl Makefile.PL
# make test
# make
# make install
3. Install MyTop
After TermReadKey installation, you can go back to usr/local/src directory
# wget http://freshmeat.net/redir/mytop/6933/url_tgz/mytop-1.6.tar.gz
# tar -zxvf mytop-1.6.tar.gz
# cd mytop-1.6
# perl Makefile.PL
# make test
# make
# make install
4 Configure MyTop
go to root (~) directory
# cd /root
make file .mytop, this is where MyTop Configuration saved
# vi .mytop
user=
pass=
host=
db=
delay=5
port=3306
socket=
batchmode=0
header=1
color=1
idle=1
Fill user, pass, host, db with your setting
5. Run MyTop
# mytop
More about MyTop
This explanation taken from MyTop Documentation.
You can read more there
The mytop display screen is really broken into two parts. The top 4 lines (header) contain summary information about your MySQL server.
MySQL on localhost (3.22.32) up 3+23:14:20 [23:54:52]
Queries Total: 617 Avg/Sec: 0.00 Now/Sec: 0.05 Slow: 0
Threads Total: 1 Active: 1 Cached: 0
Key Efficiency: 88.38% Bytes in: 0 Bytes out: 0
The first line identified the hostname of the server (localhost) and the version of MySQL it is running. The right had side shows the uptime of the MySQL server process in days+hours:minutes:seconds format (much like FreeBSD’s top) as well as the current time.
The second line displays the total number of queries the server has processed, the average number of queries per second, the real-time number of queries per second, and the number of slow queries.
The third line deals with threads. And the fourth line displays key buffer efficiency (how often keys are read from the buffer rather than disk) and the number of bytes that MySQL has sent and received.
The second part of the display lists as many threads as can fit on screen. By default they are sorted according to their idle time (least idle first). The display looks like:
Id User Host Dbase Time Cmd Query or State
– —- —- —– —- — ————–
61 jzawodn localhost music 0 Query show processlist
The thread id, username, host from which the user is connecting, database to which the user is connected, number of seconds of idle time, the command the thread is executing, and the query info are all displayed.