Monday, November 23, 2015

apache user permisions

ls -l /var/www
sudo groupadd www
sudo usermod -a -G www user-name

// logout and login

to check group : groups
sudo chown -R root:www /var/www
[ec2-user ~]$
sudo chmod 2775 /var/www
[ec2-user ~]$
find /var/www -type d -exec sudo chmod 2775 {} +

Tuesday, October 13, 2015

How To Install No-ip In CentOS

No-ip client; use to update/resolve a server with a dynamic IP.

Prerequisite:

    Create a free no-ip account.  Log in to the no-ip website and create a host.
    Install “Make” compiler program in preparation to compile the no-ip program.  You might also have to install the “GCC” compiler if “Make” compiler don’t work; I have both GCC and Make installed.  The following is the  commands to download &install them:

yum install gcc

yum install make
Now onto the easy step-by-step installation of no-ip client.  Run the following 6 commands from the terminal:

    mkdir noip && cd noip
    wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
    tar zvxf noip-duc-linux.tar.gz
    cd noip-2.1.9-1
    make
    make install

You will then need to answer the following prompts:

Please enter the login/email string for no-ip.com

(Email account that you used to set-up no-ip account from their website)

Please enter the password for user

(Password that you used to login to no-ip website)

Please enter an update interval: [30] 30

(Increments in minutes that you want no-ip client to check if your router’s external dynamic IP address has changed and updates it accordingly.)

Do you wish to run something at successful update? [N] (y/N)

(Enter “N” here)
Now start no-ip client by running the following command:
/usr/local/bin/noip2
Now have no-ip client start every time the computer reboot by issuing the following command:
echo ‘/usr/local/bin/noip2’ >> /etc/rc.local
More useful no-ip commands:

    /usr/local/bin/noip2 -C                                       to configure noip client

    /usr/local/bin/noip2 -S                                       to display info about running noip client

    /usr/local/bin/noip2 -U                                       to set update intervals (in minutes)

Thursday, October 8, 2015

Centos disk space allocation

You need to unmount a filesystem to shrink it. So, for /home you'll want to be log in as root and umount /home. If it's 'busy'. You may need to stop any processes using files here.

Then, shrink the file system to just below your targeted logical volume size.

resize2fs /dev/mapper/vg_nastgweblls01-lv_home 99G

Shrink the logical volume to the targeted size.

lvreduce -L 100G /dev/mapper/vg_nastgweblls01-lv_home

Grow the filesystem to the logical volume's capacity.

resize2fs /dev/mapper/vg_nastgweblls01-lv_home

The reason I do it this so I don't have to do any math and keep the filesystem the size of the container. A bit lazy, but it works great.

Now, you have free space to grow root.

lvextend -L 75G /dev/mapper/vg_nastgweblls01-lv_root
resize2fs /dev/mapper/vg_nastgweblls01-lv_root


* remembered that I need to mount the home drive

mount /home