Total Pageviews

Wednesday, 30 April 2014

2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock (2)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
it is not the error bcoz when mysql deamon starts it 1st checks the /tmp/mysql.sock
if /tmp permission changes to other than 777 then the above error comes
i've faced the same error 
when i checked /var/lib/mysql/ for mysql.sock it didn't found there it never happens when it is not found but if not found then try to create uor self command is

cd /var/lib/mysql 
touch mysql.sock
chown mysql:mysql mysql.sock
chmod 1777 mysql.sock

now make a sym link into /tmp 

ln -s /var/lib/mysql/mysql.sock /tmp
then
chmod 1777 /tmp

now 
/scripts/mysqlup --force


now just restart mysql
/etc/rc.d/init.d/mysql restart

Wednesday, 9 April 2014

Oracle Solaris 11 Installation Steps..

Step-by-Step Installation of Oracle Solaris 11 SPARC

Ensure that your hardware supports Oracle Solaris 11 Operating System. If you are unsure, please visit the below URL and check the compatibility list:

http://www.oracle.com/webfolder/technetwork/hcl/data/s11ga/index.html

You can download Solaris 11 operating system iso image here:
http://www.oracle.com/technetwork/server-storage/solaris11/downloads/index.html

Select ‘Download for SPARC – Text Install’. Please check MD5 checksun to ensure the downloaded file is not corrupt. After having downloaded this image, please write it to DVD using any ISO burner (such as Free ISO Burner).

Connect to the system console either via ILOM, ALOM, XSCF etc through serial cable or SSH over the network in case of remote management configured. Login to the console, in my example a T2000 machine has been used.

On SC prompt type console –f and console respectively and hit enter. You will now get OK prompt, if you powered on the server. Please note, you cannot do a version upgrade from Solaris 10 to Solaris 11. There are several differences in these two versions, many features are now obsolete. Solaris 11 has to be a fresh install.

Make sure Solaris 11 DVD is inserted in the DVD drive. Now type boot cdrom on OK prompt to begin installation as shown in the below screenshot:


The pre-installation phase or requirements gathering phase will being. Oracle Solaris 11 will ask several questions with options to you. The first step is to select the keyboard layout of your choice. Defaut keyboard layout for Oracle Solaris 11 installation via DVD is US-English.



Next, select the language of your choice, default installation language for Oracle Solaris 11 is English.

Next step will give you an option to Install Oracle Solaris. If you are using a remote ssh session on shell, I would rather select 4 Terminal type and specify the correct terminal type I am using, in order for me to have a aligned display of the installation screens. The next page will give you further details about this.



Select option 4 and select the correct terminal type. vt100 is your best if you are unsure about what terminal type are you using. While installing Oracle Solaris 11, the screen type chosen here will help you a lot.



Select 1 to install Oracle Solaris 11. As you can see 1 is the default value, hence you can just press enter/return key here.


Next screen will show you the location of installation log, which is /system/volatile/install_log.
Remember, from here until completion of install Oracle Solaris 11, you can move to forward screen by pressing F2 or to quit you can press F9.


After you are on next screen of Solaris 11 installation, you will have the disk option, disk where Oracle Solaris 11 will be installed. Very important point to note and also, a considerable difference from Solaris 10 to Solaris 11 is noticed in this step. Solaris 11 is installed on rpool. Yes, zfs is the default file system of Oracle Solaris 11. To remind you, Solaris 10 has UFS as default file system.


Select the desired disk, I would recommend a whole disk for the installation, however, you have the option to install it on a single slice.

Now, Oracle Solaris 11 installer will give you option to choose a hostname. Type any name that you want. If you want to change it later, you can change hostname from Solaris 11 operating system once the system is fully installed. The default name is solaris.


You will also get options to choose from regarding how would you like to setup networking on the machine. If you are using DHCP you can select ‘Automatically’ or if you know the IP address, netmask value and gateway address, you can select Manually and provide these details for an interface to be plumbed and IP configured. Alternatively, if you are experienced with Oracle Solaris 10, you can choose ‘None’ to manually plumb and configure network interface later, after the Operating System is installed.

Next screen is to select time zone:

Now select location that contains your time zone, press F2 to continue:

Select Time Zone based on your location or preference:

Next screen to set password for root and user account for yourself. 


Next screen is Installation summery, verify and press F2 if everything correct.



Installation will take around 15 to 20 minutes to complete. Here you can see installation progress.

Installation completed, press F8 to reboot.


Tuesday, 8 April 2014

Create Custom YUM Repository


Custom YUM Repository

Sometimes we need to create a Custom YUM Repository (handy when the VPS has no internet connection). We can create a Custom YUM Repository from a desired number of selected RPM package files. Custom YUM Repository only holds the RPM package files we want to include in. 
Step 1: Install "createrepo"
To create Custom YUM Repository we need to install additional software called "createrepo" on our cloud server. We can install "createrepo" by running the following command from console:

yum install createrepo

Step 2: Create Repository directory
We need to create a new directory that will be the location of our Custom YUM Repository and will hold the desired RPM package files. We can do this with the following command from console (choose a different /repository1 directory name if you like):

mkdir /repository1
Step 3: Put RPM files to Repository directory
If RPM package files are not yet present on our VPS we need to transfer them to our cloud server via FTP or SSH - use software like WinSCP (free SFTP client and FTP) or similar. We can also download RPM package files directly to our VPS (internet connection needed) with "wget" command from console (please change HTTP link accordingly):

wget ftp://my.barun.com/CentOS/6/os/i386/Packages/NetworkManager-0.8.1-43.el6.i686.rpm

If RPM files are already present on our VPS, we need to Copy or Move these files to the newly created directory from "Step 2". We can move RPM files with the following command from console (please change /path/to/rpm and /repository1 accordingly):

mv /path/to/rpm /repository1

We can copy RPM files with the following command from console (please change /path/to/rpm and /repository1 accordingly):
cp /path/to/rpm /repository1
Step 4: Run "createrepo"
Createrepo command reads through Custom YUM Repository directory from "Step 2" and creates a new directory called "repodata" in it. Repodata directory holds the metadata information for the newly created repository. Every time we add additional RPM package files to our Custom YUM Repository, we need to re-create Repository metadata with "createrepo" command. We can create new repository metadata by running the following command from console (please change /repository1 accordingly):
createrepo /repository1
Step 5: Create YUM Repository Configuration file
To start using the newly created Custom YUM Repository, we must create the corresponding YUM Repository Configuration file with .repo extension, which must be placed to /etc/yum.repos.d/ directory. Instructions to create YUM Repository Configuration file are covered in the first topic of this article called "YUM Repository Configuration File". 
Example Custom YUM Repository Configuration file:
/etc/yum.repos.d/custom.repo
[customrepo]
name=Custom Repository
baseurl=file:///repository1/
enabled=1
gpgcheck=0

YUM Repository Configuration File

We can install new software on Red Hat/CentOS Linux with "yum install packagename" command from console. Running this command first checks for existing YUM Repository configuration files in /etc/yum.repos.d/ directory. It reads each YUM Repository configuration file to get the information required to download and install new software, resolves software dependencies and installs the required RPM package files.

YUM Repository configuration files must:



be located in /etc/yum.repos.d/ directory



have .repo extension, to be recognized by YUM

Available YUM Repository configuration file options are:



Repository ID - One word unique repository ID (example: [examplerepo])



Name - Human readable name of the repository (example: name=Example Repository)



Baseurl - URL to the repodata directory. You can use file://path if repository is located locally or ftp://link, http://linkhttps://link if repository is located remotely - HTTP Authentication availablehttp://user:password@www.repo1.com/repo1 (example: baseurl=http://mirror.cisp.com/CentOS/6/os/i386/)



Enabled - Enable repository when performing updates and installs (example: enabled=1)



Gpgcheck - Enable/disable GPG signature checking (example: gpgcheck=1)



Gpgkey - URL to the GPG key (example: gpgkey=http://mirror.cisp.com/CentOS/6/os/i386/RPM-GPG-KEY-CentOS-6)



Exclude - List of the packages to exclude (example: exclude=httpd,mod_ssl)



Includepkgs - List of the packages to include (example: include=kernel)

Required YUM Repository configuration file options are:



Repository ID



Name



Baseurl



Enabled


Linux User Based Troubleshooting..!!

Scene 1: /etc/passwd is deleted
This is an important file in Linux as it contains information about user accounts and passwords. If it’s missing in your system and you try to log in to a user account, you get an error message stating Log-in incorrect and after restarting the system.
Now that you have seen the problem and its consequences, it’s time to solve it. Boot into single user mode. At the start of booting, press any key to enter into the GRUB menu. Here you will see a list of the operating systems installed. Just select the one you are working with and press.
It’s time to have some fun with kernel parameters. So highlight the kernel and again press e to edit its parameters.
Next, instruct the kernel to boot into single user mode, which is also known as maintenance mode. Just type 1 after a space and press the Enter key. Now press b to continue the booting process.
Now that you have booted into single user mode, you are probably asking yourself, What is next?. The tricky portion of this exercise is now over and it takes just one command to have your passwd file in its place. Actually, there is a file /etc/passwd-, which is nothing but the backup file for /etc/passwd. So all you need to do is to issue the following command:
cp /etc/passwd- /etc/passwd
…and you are done. Now you can issue the init 5 command to switch to the graphical mode. Everything is fine now. You can also find the backup of /etc/shadow and /etc/gshadow as /etc/shadow- and /etc/gshadow- respectively.
Scene 2: /etc/pam.d/login is deleted
If your /etc/pam.d/login file is deleted and you try to log in, it won’t ask you to enter your password after entering your username. Instead, it will continuously show the localhost login prompt. Here again, there is a single command that will solve the problem for you:
cp /etc/pam.d/system-auth /etc/pam.d/login
Just boot into the single user mode as done earlier, type this command and you’ll be able to log in normally. There is also a second solution to this problem, which we’ll look at after a while.
Scene 3: /etc/inittab is deleted
We know that in Linux, init is the first process to be started and it starts all the other processes. The /etc/inittab file contains instructions for the init process and if it’s missing, then no further process can be launched. On starting a system with no inittab file, it will show the following message:
INIT:No inittab file found …and will ask you to enter a runlevel. When you do that, it again shows the message that no more processes are left in this runlevel.
Fixing this problem is not easy because being in the single user mode doesn’t help in this case. Here, you need the Linux rescue environment to fix this problem. So set your first boot device to CD and boot with the RHEL5 CD. At the boot prompt, type ‘Linux rescue’ to enter the rescue environment.
Once you have entered into the rescue environment, your system will be mounted under /mnt/sysimage. Here, reinstall the package that provides the /etc/inittab file. The overall process is given below:
chroot /mnt/sysimage 
rpm -q --whatprovides /etc/inittab 
mkdir /a 
mount /dev/hdc /a 
 
Here /dev/hdc is the path of the CD. It may vary on your system, though. 
 
rpm –Uvh --force /a/Server/initscripts-8.45.25-1.el5.i386.rpm
You can also hit the Tab key after init to auto complete the name.
Now you’ll get your /etc/inittab file back. The same procedure can be applied to recover the /etc/pam.d/login file. In this case, you’ll have to install the util-linux package. Once you are done with it, type Exit to leave the rescue environment, set your first boot device to hard disk and boot normally.
Scene 4: /boot/grub/grub.conf is deleted
This file is the configuration file of the GRUB boot loader. If it is deleted and you start your machine, you will see a GRUB prompt that indicates that grub.conf is missing and there is no further instruction for GRUB to carry on its operation.
But don’t worry, as we’ll solve this problem, too, in the next few minutes. You don’t even need to enter single user mode or the Linux rescue environment for this. At the GRUB prompt, you can enter some command that can make your system boot. So here we go: Type root (and hit Tab to find out the hard disks attached to the system. In my case, I got hd0 and fd0—the hard disk and floppy disk, respectively). Now we know that GRUB is stored in the first sector of a hard disk, which is hd0,0. So the complete command would be root (hd0,0). Enter this command and press the Enter key to carry on.
You now need to find out the kernel image file. So enter kernel /v and hit Tab to auto complete it. In my system, it’s vmlinuz-2.6.18-128.el5. Please note it down as we’ll require this information further, and then press Enter.
Next, let’s figure out the initrd image file. So enter initrd /i and press Tab to auto complete it. For me, it’s initrd-2.6.18-128.el5.img. Again note it down and press Enter.
Type boot and press Enter, and the system will boot normally.
Now it’s time to create a grub.conf file manually. So create the /boot/grub/grub.conf file and enter the following data in it:
 
splashimage=(hd0,0)/grub/splash.xpm.gz 
default=0 
timeout=5 
title Red Hat 
root (hd0,0) 
kernel /vmlinuz-2.6.18-128.el5 
initrd /initrd-26.18-128.el5.img
Save the file and quit it. You have created a grub.conf file manually to resolve the problem. Don’t forget that the kernel and the initrd image file name may vary on your system. That’s why I asked you to note them down earlier. You can also find them in the /boot folder once you are logged in it’s not a big issue.