Posts

Showing posts from August, 2013

LAMP installation from source code ( tarball) on linux

Image
Tested with ubuntu 12.04 LTS  with mysql version 5.1.71, php 5.3.25  and apache 2.2.25 bellow packages must be installed on ubuntu sudo apt-get install zlib1g-dev libncurses5-dev sudo apt-get install g++ sudo apt-get install libgdbm-dev sudo apt-get install libxml2-dev Installing MySQL 5.1 Download MySQL source tarballs Open a terminal and login Extract the source to some folder(say ‘/usr/src/mysql’). $ sudo mkdir /usr/src/mysql $ sudo cp mysql-VERSION.tar.gz /usr/src/mysql $ cd /usr/src/mysql $ tar -xvf mysql-VERSION.tar.gz $ cd mysql-VERSION For added security we will create a new user called ‘mysql’ and use this user while running MySQL. $ sudo groupadd mysql $ sudo useradd -g mysql mysql Lets compile $ ./configure --prefix=/usr/local/mysql $ make $ make install configure MySQL . $ cp support-files/my-medium.cnf /etc/my.cnf $ cd /usr/local/mysql $ sudo mkdir /usr/local/mysql/var $ bin/mysql_install_db --user=mysql $ chown -R root.mysql . $ chown

how to create a ca Certificate Authority in RHEL 6.x

Change directory to the default CA directory: # cd /etc/pki/CA Create an index file for new certs: # touch index.txt Set first certificate number: # echo ’01′ > serial # echo ’01′ > crlnumber Create your CA cert and private key for your CA server: # openssl req -new -x509 -extensions v3_ca -keyout private/ca-cert.key -out certs/ca-cert.crt -days 365 Enter PEM pass phrase: <your passpharse> Confirm PEM pass phrase: <your passpharse> Country Name: IN State: West bengal City: Kolkata Organization: Example Organizational Unit: Example Common Name: CA E-mail Address: [email protected] Set permissions on your private key: # chmod 400 private/ca-key.key Now when you get a new certificate request, the following action need to perform to  generate a new cert signed by ca server : From your CA server, change directory to /etc/pki/CA # cd /etc/pki/CA Copy your certificate request to the /etc/pki/CA/crl directory # cp /root/ds1.csr /etc/pki/CA/crl

How to install My sql 5.1 from tarball on Linux (generic)

Download mysql 5.1 package (the tarball) from here - http://dev.mysql.com/downloads/mirror.php?id=414182   Now do follow sudo apt-get purge mysql-server mysql-common  #### this will purge any privious or other mysql installation ##### Now untar the archive in src directory sudo tar -xvzf mysql-5.1.71.tar.gz --directory=/usr/local/src cd /usr/local/src/mysql-5.1.71/ sudo groupadd mysql sudo useradd -g mysql mysql sudo ./configure --prefix=/usr/local/mysql sudo make sudo mkdir /usr/local/mysql sudo mkdir /usr/local/mysql/include sudo mkdir /usr/local/mysql/include/mysql sudo mkdir /usr/local/mysql/lib sudo mkdir /usr/local/mysql/lib/mysql sudo mkdir /usr/local/mysql/share sudo mkdir /usr/local/mysql/man sudo mkdir /usr/local/mysql/mysql-test sudo mkdir /usr/local/mysql/var Now install checkinstall package for checking your make sudo apt-get install checkinstall now check your make as bellow- sudo checkinstall default will prompt to yes --enter now at the >> prompt

GPG invalid signature problem in ubuntu

Run bellow commands if there is problem with gpg key invalid error while updating apt chache  by using  $ sudo apt-get update this is very common issue sometimes happens after update ubuntu $ sudo apt-get clean $ cd /var/lib/apt $ sudo mv lists lists.old $ sudo mkdir -p lists/partial $ sudo apt-get clean $ sudo apt-get update

single ip multiple website hosting with rhel6.x/centos6.x virtual hosting

It is often useful to host multiple website on single ip to save resources of server. This can be done by virtual host in your RHEL 6.x or centos 6.x go to apache configuration directory # cd /etc/httpd/conf.d create a new file  myhost.conf # vi myhost.conf paste following lines  and change entries as per yours  NameVirtualHost *:80 <VirtualHost *:80>     ServerAdmin [email protected]     DocumentRoot "/home/websites/harshenterprises.org/"     ServerName harshenterprises.org     ServerAlias www.harshenterprises.org     ErrorLog "/var/log/httpd/harshenterprises/error_log"     CustomLog "/var/log/httpd/harshenterprises/access_log" common </VirtualHost> <VirtualHost *:80>     ServerAdmin [email protected]     DocumentRoot "/home/websites/dsstech.co.in"     ServerName dsstech.co.in     ServerAlias www.dsstech.co.in     ErrorLog "/var/log/httpd/dsstech/error_log"     CustomLog "

Postfix Mail Server on RedHat 6 /CentOS 6

In this setup: IP address of server = 161.101.234.62 Hostname = mail Domain Name = mylab.local Full Computer name (FQDN) = mail.mylab.local Note: Make sure DNS Server is properly configured. Install Required package: yum install postfix dovecot squirrelmail http  -y # vim  /etc/postfix/main.cf inet_interface   =   all # inet_interface   =  localhost mydestination =  $myhostname,  localhost.$mydomain, localhost,  $mydomain home_mailbox =  Maildir/ vim  /etc/dovecot.conf protocols  =  imap  imaps  pop3  pop3s mail_location  = maildir:~/Maildir pop3_uidl_format  =  %09Xu%09Xv imap_client_workarounds = outlook-idle  delay-newmail  netscape-eoh pop3_client_workarounds = outlook-no-nuls    oe-ns-eoh vim  /etc/squirrelmail/config.php $domain                       = ‘mylab.local’; $imapServerAddress    = ‘161.101.234.62’; $smtpServerAddress    = ‘161.101.234.62’; $default_folder_prefix   = ‘Maildir/’; service  po

How to create bulk user from csv in openldap server

We all want to know how we can create bulk users if we have excell or csv file in our hand only? I am telling you the solution. First let me make you very clear openldap cannot accept excel or csv format directly. It is possible to   generate a ldif file from  csv and then we can use ldapadd command to add all users. So here i have created a shell script to convert csv to ldif. 1. Create a file named create.awk   and paste bellow script lines and save it. BEGIN { start_uid = 501; start_gid = 502; i=0; } { print "dn: uid="$1", ou=People,dc=mydomain,dc=com" print "givenName: ",$2 print "sn: ",$3 print "loginShell: /bin/bash"  print "uidNumber : "(start_uid+i);  print "gidNumber : "(start_gid+i);  print "shadowMax: 99999"  print "mail: "$1"@mydomain.com" print "objectClass: person"  print "objectClass: top" print "objectClass: organizationalPerson" pri

NIC Bonding in centos 6.x /rhel 6.x

This post is useful in case you have more then 1 NIC card but with poor speed e.g. 10 MBPS  and you require higher bandwidth transmission. we can bind two or more NIC ( eth0,eth1,eth2........)   in one bonding interface to achieve a good bandwidth. here is the steps to perform. Create bond0 config file: vi /etc/sysconfig/network-scripts/ifcfg-bond0 Add the following lines: DEVICE=bond0 IPADDR=192.168.1.20 NETWORK=192.168.1.0 NETMASK=255.255.255.0 USERCTL=no BOOTPROTO=none ONBOOT=yes (Replace above IP address with your actual IP address. Save file and exit to shell, esc :wq) Edit eth0 config file: vi /etc/sysconfig/network-scripts/ifcfg-eth0 Add the following lines: DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none Edit eth1 config file: vi /etc/sysconfig/network-scripts/ifcfg-eth1 Add the following lines: DEVICE=eth1 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none Load the modules on boot: vi /etc/modprobe.conf

Creating local repo for fedora

Creating local repo for fedora Requirment : createrepo package should be already installed in system if not, get it install by using yum # yum install createrepo -y Now method :  insert your fedora disk and mount it on /media now create a directory to copy files from cd. # mkdir /myrepo now copy  all rpm files from cd to the folder. I will use find command to search all rpm files and copy # find /media -name "*.rpm" -exec cp {} /myrepo/ \; Now create repo metadata # createrepo -v /myrepo create a repo file for above base # vi /etc/Yum.repose.d/local.repo insert follow lines  and save the file [local] name=My Local Repository baseurl=file:///myrepo gpgcheck=0 enabled=1 Done!!!   just test # yum repolist