Wednesday, January 18, 2012

CentOS Change Hostname

In order to see the hostname type uname -n and dnsdomainname to see

Perform the steps below as root or sudo
  1. Change the HOSTNAME in /etc/sysconfig/network to desired new hostname
  2. Change the hostname in /etc/hosts. (Add to the same line as localhost)
  3. Source /etc/sysconfig/network
  4. Type hostname $HOSTNAME
  5. logout and log back in.

TIP: If you would like to strip off the domain name portion, which is stored elsewhere anyway.

  • sed -i.bak 's/\.[a-z].*//g' /etc/sysconfig/network

Reference
http://www.how2centos.com/centos-change-the-hostname/

Wednesday, September 14, 2011

Reset MySQL root password


  • Kill the mysql process using. Some process has may not be in the folder in the example below. The folder can be found my using ps aux | grep mysqld and looking for the file that ends with .pid or starts with mysqld
    • $: kill `cat /var/run/mysqld/mysqld.pid`


  • Create a file with entries below.
    • UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';

    • FLUSH PRIVILEGES;


  • Start mysql using the command below. Where --init-file is the path to the file created above.
    • mysqld_safe --init-file=/home/me/mysql-init &


  • Login to mysql using the new mysql root password

MySQL root password should be reset now.

Reference: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix

Monday, July 11, 2011

Setup SVN on CentOS

http://wiki.centos.org/HowTos/Subversion

Sunday, March 6, 2011

VMware: Increase disk space of Linux VM


  • Increase disk space to desired size using the VM Client.

  • Login to the VM and restart the machine (init 6)

  • After restart go to fdisk (fisk /dev/sda or /dev/hda etc.)

  • Create new partition using fdisk, save and exit.

  • If an LVM is used then the newly created partition will be needed to added the the LVM.


  • Follow instructions below. Assume new partition is /dev/sda3 (4GB), volume group is VolGroup-00 and Logical volume is LogVol-100

  • pvcreate /dev/sda3

  • vgextend VolGroup00 /dev/sda3

  • lvextend -L +4G /dev/mapper/VolGroup00-LogVol00

  • resize2fs /dev/mapper/VolGroup00-LogVol00



  • Wednesday, January 26, 2011

    Set umask for a specific directory

    Use the setfacl command. Examples below from man.

    EXAMPLES
    Granting an additional user read access
    setfacl -m u:lisa:r file

    Revoking write access from all groups and all named users (using the effective rights mask)
    setfacl -m m::rx file

    Removing a named group entry from a file’s ACL
    setfacl -x g:staff file

    Copying the ACL of one file to another
    getfacl file1 | setfacl --set-file=- file2

    Copying the access ACL into the Default ACL
    getfacl --access dir | setfacl -d -M- dir



    Found solution here

    http://www.linuxforums.org/forum/slackware-linux/156119-solved-umask-specific-directory.html

    Thursday, September 16, 2010

    Wednesday, September 1, 2010

    Recover GRUB menu after Ubuntu 9.10 update

    A couple the GRUB menu got screwed up after an update. The recover process can be found here. But I had to take a couple additional steps to fix my GRUB.

    1. Figure what your where your /boot and /root partition is installed in. My /boot was /dev/sdc2 and /root was /dev/sdc3.
    2. Mount /root to /mnt using sudo mount /dev/sdc3 /mnt
    3. Mount /boot to /mnt/boot using
      mount /dev/sdc2 /mnt/boot.
      NOTE: If both /root and /boot are on the same partition then you only have to mount the /root partition.
    4. Check /mnt/boot/grub/device.map for an entry for /dev/sdc.
    5. If /dev/sdc does not exist, then add it using vi. For example, the entries in mine were
      (hd0) /dev/sda
      (hd1) /dev/sdb

      So I added (hd2) /dev/sdc to list.
    6. If this was not added to the list, the /root partition will not be found and the grub recovery will fail.
    7. Next re-install the grub by executing
      sudo grub-install --root-directory=/mnt /dev/sdc
    8. Reboot
    9. Refresh the GRUB 2 menu by executing update-grub2