TWL's Algorithms

Archive for February, 2017

How to install Ruby on Rails in CentOS 7

  1. Login as root
  2. Install the requisite libraries by using the following command
    yum -y install gcc gcc-c++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
  3. Download the latest version of ruby to your host. E.g.
    wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.gz
  4. Extract and install ruby
    tar -zxvf ruby-2.4.0.tar.gz
    cd ruby-2.4.0
    ./configure
    make && make install
  5. Install rails
    gem install rails
  6. Install a javascript runtime, e.g. therubyracer
    gem install therubyracer
  7. Create a directory for your ruby on rails site and change directory to that path.
    rails new blog
    cd blog
  8. Open Gemfile and add this below the first line
    gem 'therubyracer'
  9. Start rails
    rails server
  10. Open a browser and go to localhost:3000 to verify that your site is working.

 

Install vlc player for CentOS 7

Currently running on CentOS 7.3.1611

  1. Install epel
    yum -y install epel-release
  2. Update
    yum -y update
  3. Install nux-dextop
    rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  4. Install vlc
    yum -y install vlc

CentOS 7 on high dpi screen in VMWare (Macbook 2013 retina)

The screen resolution of CentOS 7 looks very small in VMWare.

How to increase it?

  1. Log in as root.
  2. Run xrandr to see the available screen resolutions.
  3. Modify the following command accordingly to change the screen resolution.
    xrandr –output Virtual1 –mode 1920×1200
  4. Modify the following command to make the menus and fonts look bigger after changing the resolution.
    xrandr –output Virtual1 –scale 0.65×0.65

 

See console messages in CentOS 7

 

Open /etc/default/grub and configure the GRUB_CMDLINE_LINUX option. Delete rhgb quiet from the string.

Run this command to save changes.

grub2-mkconfig -o /boot/grub2/grub.cfg

 

CentOS 7 remove home partition and extend root partition

How?

  1. Unmount home partiton

    umount /home

  2. Show logical volumes and look for the home volume.

    lvdisplay

      .
      .
      --- Logical volume ---
      LV Path                /dev/myhost/home
      LV Name                home
      VG Name                centos
      .
      .
  3. Remove the home volume

    lvremove /dev/myhost/home

  4. Verify that you have free space.

    vgs

  5. Take note of where your root is located

    df -h

    Filesystem                Size  Used Avail Use% Mounted on
    /dev/mapper/myhost-root    50G  1.2G   49G   3% /
    .
    .
  6. Resize root partition to reclaim all free space.

    lvextend -l +100%FREE /dev/mapper/myhost-root

  7. Remove the line containing the home directory from /etc/fstab
  8. Reboot.