Create DNS server in Ubuntu version

1) Install bind9
#aptitude install update
#aptitude install bind9 dnsutils

2)Configure local Network
 #sudo nano /etc/hosts

as below

127.0.0.1       [yourhostname]   localhost.localdomain   localhost
192.168.1.x     [yourhostname].[yourdomain]              [yourhostname]
 

eg:-

 127.0.0.1       ns1 localhost.localdomain   localhost
192.168.1.2      ns1.geoffke.be              ns1


3)Configure your firewall
#sudo ufw allow 53
#sudo ufw allow bind9
 #sudo ufw app list 

4)create the zone file 


#cd /etc/bind
#sudo nano db.geoffke.be


Replace geoffke.be with your domain name to become your zone file name. Here's an example

;
; BIND zone definition file for geoffke.be
;
geoffke.be.      IN      SOA      ns1.geoffke.be. admin.geoffke.be. (
                        2011072601; Serial
                        28800
                        3600
                        604800
                        38400
)

; Nameserver and mailserver (replace with your own hostnames):
geoffke.be.        IN     NS           ns1.geoffke.be.
geoffke.be         IN     MX     10    mail.geoffke.be

; IP addresses of local hosts (replace the lines with your own hosts):
router             IN     A     192.168.1.1
ns1                IN     A     192.168.1.2
www                IN     A     192.168.1.3
mediacenter        IN     A     192.168.1.4
laptop1            IN     A     192.168.1.5
workstation1       IN     A     192.168.1.6




 5. Create the reverse zone file:

#sudo nano rev.1.168.192.in-addr.arpa

Use the following example file and replace the hosts and domain name with your own, matching the ones in the zone file above:

;
; BIND reverse zone file for geoffke.be
;
@ IN SOA ns1.geoffke.be. admin.geoffke.be. (
                        2011072601; Serial
                        28800;
                        604800;
                        604800;
                        86400
)

; IP addresses of local hosts (replace the lines with your own hosts):
        IN      NS      ns1.geoffke.be.
1       IN      PTR     router.geoffke.be
2       IN      PTR     geoffke.be
3       IN      PTR     www.geoffke.be
4       IN      PTR     mediacenter.geoffke.be
5       IN      PTR     laptop1.geoffke.be
6       IN      PTR     workstation1.geoffke.be


6. Edit the named.conf.local file:

and add the following:

zone geoffke.be {
        type master;
        file "/etc/bind/db.geoffke.be";
};

zone 1.168.192.in-addr.arpa {
        type master;
        file "/etc/bind/rev.1.168.192.in-addr.arpa";
}; 


7. Configure your clients:

domain <yourdomain.ext>
search <yourdomain.ext>
nameserver <ip_of_dns_server_1>
nameserver <ip_of_dns_server_2>
nameserver <ip_of_dns_server_3>


 If you have only one DNS server, you could use the following example:

domain geoffke.be
search geoffke.be
nameserver 192.168.1.2
nameserver 192.168.1.1


8. Test your DNS server:
Be sure that all of your hosts DNS settings on your clients point to your new DNS server before testing! Reload bind to accept the changes:

sudo service bind9 reload

Test your server with:
Source code 
dig example.com 

If your server doesn't respond correctly, you can check the logs to see what is causing the problem.
Source code
tail -f /var/log/syslog

CREATE A YUM REPOSITORY LOCALLY

Mount your CD/DVD or ISO images

DVD Disk or DVD ISO image

  • If you have DVD disk, please mount dvd-rom first, and then create yum repository:
  • # mkdir /mnt/dvd/
    # mount /dev/cdrom /mnt/dvd/
  • If you use DVD iso, please copy it to the system, and then create yum repository:
  • # mkdir /mnt/dvd/
    # mount -o loop /root/rhel5.1-dvd.iso /mnt/dvd

CD images

If you have multiple CD image files, you should mount all iso images and then create yum repository.
  • Mount all iso images:
  • # mkdir -p /mnt/{1,2,3,4,5}
    # mount -o loop rhel5.1-disc1.iso /mnt/1
    # mount -o loop rhel5.1-disc2.iso /mnt/2
    # mount -o loop rhel5.1-disc3.iso /mnt/3
    # mount -o loop rhel5.1-disc4.iso /mnt/4
    # mount -o loop rhel5.1-disc5.iso /mnt/5

Install necessary package

  • Find and install 'createrepo' package in /mnt directory:
  • # find /mnt -iname 'createrepo*'
    /mnt/dvd/Server/createrepo-0.4.11-3.el5.noarch.rpm
    # rpm -ivh /mnt/dvd/Server/createrepo-0.4.11-3.el5.noarch.rpm

Create yum repository

Create metadata

  • Create yum repository:
  • # cd /mnt/
    # createrepo .

Define yum repository

Create yum repository define file /etc/yum.repos.d/dvdiso.repo:
[ANYNAME]
name=ANYNAME
baseurl=file:///mnt/
enabled=1
gpgcheck=0

Test it

# yum clean all
# yum list

ಥಾಟ್ಸ್ ಇಟ್ ಡನ್

Editing or Adding Grub 2 Menu Entries

Open these three entering via terminal 

$ sudo gedit /etc/default/grub

$ sudo gedit /etc/grub.d/40_custom

$ sudo gedit /boot/grub.cfg

From the grub.conf copy the content which starts from 
#BEGIN
menuentry

After u done that you run the command :

$  sudo update-grub


CREATE JAIL FOR USER TO THEIR HOME DIRECTORY


-->
  • You need the GNU Compiler Collection to install these programs.
yum install gcc

  • Install zlib
--------------------------------------------------------------------------------------------------------------------------------------
cd /tmp
mkdir -p /opt/zlib
mkdir zlib1.25
cd zlib1.25/
wget http://zlib.net/zlib125.zip
unzip zlib125.zip
make
make install prefix=/opt/zlib/
--------------------------------------------------------------------------------------------------------------------------------------
  • Now we install openssl into the opt directory as well
The make commands here take forever to run. If the 'make test' command returns any errors, you will need to fix them before continuing.

--------------------------------------------------------------------------------------------------------------------------------------
cd /tmp
mkdir -p /opt/openssl
wget http://www.openssl.org/source/openssl-1.0.0e.tar.gz
tar xvzf openssl-1.0.0e.tar.gz
cd openssl-1.0.0e
./config --prefix=/opt/openssl --openssldir=/opt/openssl
make
make test
make install
--------------------------------------------------------------------------------------------------------------------------------------
  •  Next we will download openssh
--------------------------------------------------------------------------------------------------------------------------------------
cd /tmp
mkdir -p /opt/openssh
wget http://mirror.team-cymru.org/pub/OpenBSD/OpenSSH/portable/openssh-5.9p1.tar.gz
tar xvzf openssh-5.9p1.tar.gz
cd openssh-5.9p1
--------------------------------------------------------------------------------------------------------------------------------------
  • Now we will install openssh. To find where your xauth file is located you may need to run the "which xauth" command. If you know what you are doing you may add your own options to the configure command below.
Some of these commands make take some time to run. Go grab a coke.
REMEMBER: This tutorial is meant for setting up a server for the first time. You may need to copy your sshd_config file (or at least the directives you want to keep) from /etc/ssh to save your old settings.

--------------------------------------------------------------------------------------------------------------------------------------
./configure --prefix=/opt/openssh --with-ssl-dir=/opt/openssl --with-xauth=/usr/X11R6/bin/xauth --with-zlib=/opt/zlib
make
make install
--------------------------------------------------------------------------------------------------------------------------------------


  • To automatically run the new ssh shell, we will use init. You need to change the following lines in /etc/init.d/sshd
--------------------------------------------------------------------------------------------------------------------------------------
# Some functions to make the below more readable
KEYGEN=/opt/openssh/bin/ssh-keygen
SSHD=/opt/openssh/sbin/sshd
RSA1_KEY=/opt/openssh/etc/ssh_host_key
RSA_KEY=/opt/openssh/etc/ssh_host_rsa_key
DSA_KEY=/opt/openssh/etc/ssh_host_dsa_key
--------------------------------------------------------------------------------------------------------------------------------------
  • Then we will restart ssh and test to see if it is running smoothly.
--------------------------------------------------------------------------------------------------------------------------------------
/etc/init.d/sshd restart
telnet localhost 22
--------------------------------------------------------------------------------------------------------------------------------------

The telnet command should return some lines looking like this:
You need to be sure that the last line includes the "OpenSSH_5.9" to confirm that it is the version we just installed.

--------------------------------------------------------------------------------------------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
SSH-2.0-OpenSSH_5.9
--------------------------------------------------------------------------------------------------------------------------------------


  • Next you need to edit '/opt/openssh/etc/sshd_config' to enable the jail.
    Replace any lines starting with 'subsystem' with this line:
--------------------------------------------------------------------------------------------------------------------------------------
Subsystem sftp internal-sftp
--------------------------------------------------------------------------------------------------------------------------------------
Also add (at the bottom of the file) the following lines
--------------------------------------------------------------------------------------------------------------------------------------
Match Group sftponly
ChrootDirectory /home/%u
ForceCommand internal-sftp
AllowTcpForwarding no
Now, all users added to the 'sftponly' group will be jailed to their home directory.
--------------------------------------------------------------------------------------------------------------------------------------
  • We will need to create the 'sftponly' group so we can add our untrustworthly users to it. Also, we set up the environment to allow jailing.
--------------------------------------------------------------------------------------------------------------------------------------
groupadd sftponly
chown root:root /home
chmod 755 /home
--------------------------------------------------------------------------------------------------------------------------------------
Now when you create users that need to be jailed, make sure they belong to the 'sftponly' group. For the user "mark" with the password "test", you will need to do the folling steps.

--------------------------------------------------------------------------------------------------------------------------------------
useradd mark
usermod -g sftponly mark
usermod -s /bin/false mark
usermod -d /home/mark mark
passwd mark
--------------------------------------------------------------------------------------------------------------------------------------

  • To set up the jail run the following commands
--------------------------------------------------------------------------------------------------------------------------------------
chmod 755 /home/mark
chown root:root /home/mark
mkdir /home/mark/public_html
chown mark:sftponly /home/mark/public_html
--------------------------------------------------------------------------------------------------------------------------------------

Try to log in as mark through putty (or any ssh terminal). You should get some sort of error involving an abort or denied access.
(optinal for ftp users )
Install vsftpd
#yum install vsftpd
Now it is done 

MYSQL MASTER-SLAVE REPLICATION

MySQL Master-Slave Replication on CentOS / RHEL

 This was using MySQL 5.0 and CentOS 5.3, but this should work for most semi-recent versions of both.In this setup, transactions are mirrored to the slave server as they happen on the master.
In this tutorial I’ll use the following setup:
Master Server: 10.1.100.1
Slave Server: 10.2.200.2
MySQL Data path: /var/lib/mysql
MySQL slave user named slave_user

[Master]

First, edit the master server MySQL config file. Add/Replace the following lines

vim /etc/my.cnf
# [mysqld] section
# Start Modification
# First line is probably already there
datadir = /var/lib/mysql
server-id = 1
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/var/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
# Stop Modification
Restart MySQL to load the changes
1
service mysqld restart

[Slave]

Now we’ll do about the same thing on the slave server
1
vim /etc/my.cnf
# [mysqld] section
# Start Modification
# First line is probably already there
datadir = /var/lib/mysql
server-id = 2
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/var/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
# Stop Modification
Restart MySQL to load the changes
1
service mysqld restart

[Master]

Now we need to tell MySQL where we are replicating to and what user we will do it with.





mysql -u root -p
mysql> STOP SLAVE;
mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'slave_password';
mysql> FLUSH PRIVILEGES;
Now we will test that this side of the replication is working and get the location that we will start the replication from.









mysql> USE Any_database_name;
mysql> FLUSH TABLES WITH READ LOCK;mysql> SHOW MASTER STATUS;

+------------------+----------+--------------+------------------+
| File             | POSITION | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |   451228 |              |                  |
+------------------+----------+--------------+------------------+
1 ROW IN SET (0.00 sec)
Write down the File, Position number, as this is where we will start the replication from.
Here it is a good idea to do a dump of your master database(s) and pipe it into your slave server.


mysqldump -u root --all-databases --single-transaction --master-data=1 > /home/MasterSnapshot.sql

[Slave]

First grab your SQL dump file from the master server. You can use whatever method you would like to transfer the file. SCP example:



scp root@10.1.100.1:/path/to/MasterSnapshot.sql root@10.2.200.2:/home/MasterSnapshot.sql
Import the SQL file into MySQL


mysql -u root -p < /home/MasterSnapshot.sql
Now we’ll set the slave to read from the master server, starting at the record position we wrote down earlier. Make sure you use the MASTER_LOG_FILE and MASTER_LOG_POS from a few steps back.




mysql> CHANGE MASTER TO MASTER_HOST='10.1.100.1', MASTER_USER='slave_user', 
MASTER_PASSWORD='slave_password', MASTER_LOG_FILE='mysql-bin.000001',
  MASTER_LOG_POS=451228;
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS\G;
Make sure that from the resulting output you have the following:
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
If you don’t, check the MySQL error log to find out what is causing the problem :)

AFTER DOING THIS IF WE WANT TO KEEP DELAY FROM MASTER TO SLAVE WE SHOULD USE MAAKIT :

#rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

#yum install maatkit 
#mk-slave-delay --delay 1m --interval 15s --run-time 10m slavehost
 

SOME OF THE RED HAT NETWORK COMMAND WITH DISCRIPTION

METHOD 1
# system-config-network-tui & (this is to edit ip and dns )


METHOD 2
#system-config-network &

METHOD 3
# cd /etc/sysconfig/network-scripts/ 

You need to edit / create files as follows:
  • /etc/sysconfig/network-scripts/ifcfg-eth0 : First Ethernet card configuration file
  • /etc/sysconfig/network-scripts/ifcfg-eth1 : Second Ethernet card configuration file
To edit/create first NIC file, type command:
# vi ifcfg-eth0
Append/modify as follows:

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:30:48:56:A6:2E
IPADDR=10.10.29.66
NETMASK=255.255.255.192
ONBOOT=yes

Save and close the file. Define default gateway (router IP) and hostname in /etc/sysconfig//network file:
# vi /etc/sysconfig/network
Append/modify configuration as follows:
NETWORKING=yes
HOSTNAME=www1.nixcraft.in
GATEWAY=10.10.29.65


Save and close the file. Restart networking:
# /etc/init.d/network restart

Make sure you have correct DNS server defined in /etc/resolv.conf file:
# vi /etc/resolv.conf

Setup DNS Server as follows:
nameserver 10.0.80.11
nameserver 10.0.80.12
nameserver 202.67.222.222


Save and close the file. Now you can ping the gateway/other hosts:
 
$ ping 10.0.80.12

Output:
PING 10.0.80.12 (10.0.80.12) 56(84) bytes of data.
64 bytes from 10.0.80.12: icmp_seq=1 ttl=251 time=0.972 ms
64 bytes from 10.0.80.12: icmp_seq=2 ttl=251 time=1.11 ms

You can also check for Internet connectivity with nslookup or host command:
$ nslookup cyberciti.biz

Output:
 
 Server:         10.0.80.11
Address:        10.0.80.11#53
Non-authoritative answer:
Name:   cyberciti.biz
Address: 75.126.43.232

You can also use host command:
 
$ host nixcraft.in

Output:
nixcraft.in has address 75.126.43.232 
nixcraft.in mail is handled by 10 mail.nixcraft.in.

How to install windows OS

  1. Change the boot order in BIOS so the CD, DVD, or BD drive is listed first. Some computers are already configured this way but many are not.
    If the optical drive is not first in the boot order, your PC will start "normally" (i.e. boot from your hard drive) without even looking at what might be in your disc drive.
    Note: After setting your optical drive as the first boot device in BIOS, your computer will check that drive for a bootable disc each time your computer starts. Leaving your PC configured this way shouldn't cause problems unless you plan on leaving a disc in the drive all the time.
  2. Insert your bootable CD, DVD, or BD in your disc drive.
    How do you know if a disc is bootable? The easiest way to find out if a disc is bootable is to insert it in your drive and follow the remainder of these instructions. Most operating system setup CDs and DVDs are bootable, as are many advanced diagnostic tools like the ones I discussed above.
    Note: Programs downloadable from the Internet that are intended to be bootable discs are usually made available in ISO format. See How To Burn an ISO File for more information.
  3. Restart your computer.
  4. Watch for a Press any key to boot from CD or DVD... message.
    When booting to a Windows setup disc, and some other bootable discs as well, you may be prompted with a message to press a key to boot to the disc. To boot from the disc, you'll need to press any key on your keyboard (like the space bar) within the few seconds that the message is on the screen.
    If you do nothing, your computer will check for boot information on the next boot device in the list in BIOS (see Step 1) which will probably be your hard drive.
    Some bootable discs do not prompt for a key press and will start immediately.
  5. Your computer should now boot from the CD, DVD, or BD disc.

Install Zend Server and MySQL

Firstly, you need to create a new Cloud Server instance in the Rackspace control panel. For this tutorial, I'm using a 1024MB server with CentOS 5.6 as the operating system. This is a 64bit install.
Any lines in this tutorial starting with # should be typed at the command prompt.
Once your server is active, log on via SSH as root.
Firstly, we need to create a directory to store our downloaded files in:
  1. mkdir Downloads
  2. cd Downloads
Next, we need to go and get a few things. Zend Server will need to be downloaded from Zend. http://www.zend.com/en/products/server-ce/downloads/ Click on the 'Linux' tab and download Zend Server (DEB/RPM Installer Script). You will then need to transfer this file onto your server, into the Downloads directory. Please note, you will need to create a free account with Zend to download the package.
Once you have uploaded the package, we can grab a couple of repositories. We can use wget for these which makes our lives much easier.
  1. wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
  2. wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm or wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
We'll come back to these in a bit. Next, let's install Zend Server CE:
  1. tar -xzf ZendServer-5.1.0-RepositoryInstaller-linux.tar.gz
  2. cd ZendServer-RepositoryInstaller-linux/
  3. ./install_zs.sh 5.3 ce
  4. yum install -y php-5.3-extra-extensions-zend-server zend-server-framework-extras
And then MySQL:
  1. yum install mysql-server
  2. service mysqld start
  3. mysql_install_db
  4. /usr/bin/mysql_secure_installation
  5. chkconfig --levels 235 mysqld on
That last command will ensure that MySQL starts on boot. Next, we go back to the RPM's we downloaded earlier:
  1. cd ~/Downloads
  2. rpm -Uh remi-release-5.rpm epel-release-5-4.noarch.rpm
Now that we have installed the new repositories, we need to enable remi.repo. epel.repo is already enabled
  1. vi /etc/yum.repos.d/remi.repo
Change the line 'enabled=0' to 'enabled=1'. Just the first instance - we don't want to enable the testing repositories. Now we can install the Zend Server phpMyAdmin extension
  1. yum install phpmyadmin-zend-server-php-5.3
And configure it, by copying the sample config to a live one and setting the passphrase:
  1. cp /usr/local/zend/gui/lighttpd/htdocs/phpmyadmin/config.sample.inc.php /usr/local/zend/gui/lighttpd/htdocs/phpmyadmin/config.inc.php
  2. vi /usr/local/zend/gui/lighttpd/htdocs/phpmyadmin/config.inc.php
Find the line near the top that reads "$cfg['blowfish_secret'] = " and add a passphrase. Something random and complicated. Save and exit. As this is a remote server, we also need to reconfigure a default security setting that will only allow us access from the localhost.
  1. vi /usr/local/zend/gui/lighttpd/etc/lighttpd.conf
Search for 'phpmyadmin' and you should find the following code block:
$HTTP["remoteip"] !~ "127.0.0.1" {
  $HTTP["url"] =~ "^/phpmyadmin/" {
    url.access-deny = ( "" )
    server.errorfile-prefix = "//usr/local/zend/gui/lighttpd/share/lighttpd-custom-errors/errorcode-"
  }
}
To disable the security completely, you can simply comment out this block. Alternatively, just replace the IP Address with your own. Finally, we need to add Zend's bin and lib directories to the system path and restart Zend.
  1. vi /etc/profile
Add the following lines to the very end of this file:
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
Save and exit - then read the new profile in to memory and restart Zend:
  1. source /etc/profile
  2. zendctl.sh restart

Configure the firewall using IPTables

To explain how IPTables works with all the possible options is beyond the scope of this document. However, there is an excellent introduction to the topic here: http://wiki.centos.org/HowTos/Network/IPTables.
I have attached a shell script called iptables.sh that can be used to configure a simple but secure setup that will allow access to only SSH, Apache and Zend. The script is based on the documentation in the Centos Wiki I linked to above, so it should be easy to understand.
Create the script by pasting the code below to /usr/sbin using vi. vi /usr/sbin/iptables.sh
#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
 iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
 iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#
# Allow access to Zend Server default ports (http and https)
#
 iptables -A INPUT -p tcp --dport 10081:10082 -j ACCEPT
#
# Allow access to apache (http and https)
#
 iptables -A INPUT -p tcp --dport 80 -j ACCEPT
 iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
 iptables -P INPUT DROP
 iptables -P FORWARD DROP
 iptables -P OUTPUT ACCEPT
#
# Set access for localhost
#
 iptables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
 iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# Save settings
#
 /sbin/service iptables save
#
# List rules
#
 iptables -L -v
Give the root user execute permissions on the file:
  1. chown root iptables.sh
  2. chmod u+x iptables.sh
And run the script:
  1. ./iptables.sh
The script should load the new configuration and then print out the new ruleset. To test that it has worked, simply try and access the Zend control panel, which is blocked by default.
http://yourip:10081
You should see the Zend control panel here and be able to proceed to configuring your Zend installation.

Configure localtime and ntpd

  1. yum install -y ntp
  2. cd /etc
  3. ln -sf /usr/share/zoneinfo/GB localtime
  4. chkconfig ntpd on
  5. ntpdate pool.ntp.org
  6. service ntpd start

Configure your hostname

Rather than just running your server under an IP address, you should also configure a hostname. For this example, we will assume that your server IP address is 46.10.11.12 and you have pointed host.my-server.net at that IP address.
  1. vi /etc/hosts
Add your hostname into this file, along with the localhost directive as follows: 127.0.0.1 localhost.localdomain localhost 46.10.11.12 host.mydomain.net host
The order of the names is actually really important here if you want to install sendmail later. Sendmail wants to see the fully qualified names first, otherwise you will experience massive latency every time you restart the server or need to send emails.
Next, set the hostname:
  1. vi /etc/sysconfig/network
Enter your fqdn on the second line: HOSTNAME=host.my-server.net
Save and exit. Then restart the network service.
  1. service network restart

Creating user and changing owner of folder cent os

Creating user and changing owner of folder (here is example folder is recipease) cent os

 

1)First we should connect via sftp to the server

Then we should create a folder call logs in var/www/vhost and inside logs folder we should create two files called error_log and access_log

2)Ssh connection:# ssh root@31.222.136.20

3)then u enter password: #xyz

4)add user:#useradd recipease

5)Changing password for user recipease:#passwd recipease

6)New UNIX password:# xyz

7)(this is change of ownership)#chown -R recipease /var/www/vhosts/recipease

8) #ls -l /var/www/vhosts/recipease

9)To change ip address to host name:#sudo gedit /etc/hosts

10)To restart the server:-#zendctl.sh restart

GIVING PERMISSION TO THE FOLDER AND FILE:

1)This is used to give the permission to the folder:-

a)#chmod -R a+w /dir/




INSTALLING SEND MAIL IN THE SERVER :
  1. connect to the server via SSH.via terminal
  2. enter the send mail installation CMD as show :-
    #yum install sendmail



Get file from one domain name to other:
wget http://thewowcompany.com/blocks.tar.bz2


To Unzip:

#tar jxf acia.tar.bz2 (this is for tar.bz2 file )
#tar zxvf filename.tar.gz (this is for tar.gz file )


To Rename:

#mv source destination


copy files from server to server :
#wget http://pompeycarecouncil.co.uk/pompeycarecouncil.tar.bz2
create tar file in server :
1)connect to the server of that URL via SSH
2)go to the pertucular dir (Eg. cd /home/downhamw/public_html)
3)and zip the file there:# tar -czvf p.tar.gz *


to see all the user name added in server:
1)#cat /etc/passwd

Xdebug installation :-

Steps to install XDebug

1) Download the latest version of ( XAMPP For Linux ) From site [1]
2) Find the PHP version and copy the text of PHP version
3) Go to link [2] ,and paste content there...
4) And press the Button ( analyse my phpinfo() )
5) It will produce some output as below example follow the instruction from that output:-

Instructions
1. Download xdebug-2.1.2.tgz
  
  2. Unpack the downloaded file with tar -xvzf xdebug-2.1.2.tgz
  
  3. Run: cd xdebug-2.1.2
  
  4. Run: phpize
     As part of its output it should show:
     Configuring for:
     Zend Module Api No:      20090626
     Zend Extension Api No:   220090626
     If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
  
  5. Run: ./configure
  
  6. Run: make
  
  7. Run: cp modules/xdebug.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
  
  8. Edit /opt/lampp/etc/php.ini and add the line
     zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
  
  9. Restart the webserver

Start and Stop ssh-agent

Below is the bash script used to start and stop ss-agent #!/bin/bash ## in .bash_profile SSHAGENT=`which ssh-agent` SSHAGENTARGS="...