Showing posts with label config. Show all posts
Showing posts with label config. Show all posts

Thursday, June 11, 2020

rsync: Simple step to sync backup to remote server

The simple step:

1. Create a Local Backup of Your Data Using tar Command
# tar -zcvpf /[Backup_File_Location]/[Backup_Filename] /[User's_Home_Directory_Location]

z : Compress the backup file with ‘gzip’ to make it small size.
c : Create a new backup archive.
v : verbosely list files which are processed.
p : Preserves the permissions of the files put in the archive for later restoration.
f : use archive file or device ARCHIVE.
2. Set up Passwordless SSH Authentication


3. Create a Bash Script for Remote Backup Using rsync Command
#!/bin/bash

#Remote Server IP rserver=192.168.0.254

#Local backup location lbackuploc=/home/daygeek/Downloads/test/

#Remote backup location rbackuploc=/home/daygeek/site

#rsync command with standard port rsync -avz -e ssh $lbackuploc $rserver:$rbackuploc

#To delete files older than 10 days
find $rbackuploc/* -mtime +10 -exec rm {} \;

4. Automate a Backup Using crontab - Use the cronjob to schedule
0 8 * * * /opt/scripts/remote-backup-5.sh

SSH : Passwordless Login Using SSH Keygen


Client : 192.168.0.100
Remote : 192.168.0.254

1. Create Authentication SSH-Keygen Keys Client
#ssh-keygen -t rsa
2. Create .ssh Directory on Remote
#ssh root@192.168.0.254 mkdir -p .ssh
3. Upload Generated Public Keys to Remote
#cat .ssh/id_rsa.pub | ssh root@192.168.0.254 'cat >> .ssh/authorized_keys'
4. Set Permissions on Remote
#ssh root@192.168.0.254 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
5. SSH Login from Client to Remote host without Password
#ssh root@192.168.0.254
Source:

Thursday, April 16, 2020

Centos 7 : Extending LVM Volume



1. Check the un-partition disk under Disk GUI on Centos 7 GUI



2. Create and format disk 
#fdisk -l
#fdisk -l /dev/sda3
- to format the partition :
- n = create new partition
- p = creates primary partition
- 1 = makes partition the first on the disk
- to prepare the partition to be used by LVM :
- t = change partition type
- 8e = changes to LVM partition type
- verify and write the information to the hard drive:
- p = view partition setup so we can review before writing changes to disk
- w=write changes to disk

3. Check the LVM volume on server
#pvs - show physical volume status
#lvs - show logical volume status
#vgs - show volume group status

4. Used fdisk to create new free partition
#fdisk /dev/sda ,then enter p for print the details partition status

5. Work with  new partition create and extend LV volume
#pvcreate /dev/sda3
#vgextend "<volume group name>" /dev/sda3

6. Extend the Logical Volume
#lvextend -L +200G /dev/mapper/centos-home

* if insufficient free space status, please used this
#lvextend -l +100%FREE /dev/mapper/centos-home

7. Use xfs_growfs utility
#xfs_growfs /dev/mapper/centos-home

#resize2fs /dev/mapper/centos-home - in Centos 6

8. Recheck the disk status
#df -h

source : 
 

Monday, January 28, 2019

Friday, May 20, 2016

Friday, May 13, 2016

Tuesday, September 30, 2014

Thursday, September 4, 2014

Installing php-mcrypt in CentOS 6

For x86_64:
#rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

For i386:
#rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

After install EPEL repo:
#yum install php-mcrypt

Check list of PHP add-on that install in server:

 #yum list installed | grep php | cut -d' ' -f1

Source :

http://blog.hostonnet.com/installing-php-mcrypt-in-centos-6

Thursday, August 28, 2014

Thursday, April 17, 2014

Tuesday, April 1, 2014

Tomcat : Enable auto startup Tomcat service in Centos 6

1. Create a file named tomcat in your /etc/init.d directory
#cd /etc/init.d
#touch tomcat

2. Copy and paste script on /etc/init.d/tomcat
#!/bin/bash

TOMCAT_HOME=/opt/tomcat/bin
START_TOMCAT=/opt/tomcat/bin/startup.sh
STOP_TOMCAT=/opt/tomcat/bin/shutdown.sh

start() {
echo -n "Starting tomcat8: "
cd $TOMCAT_HOME
${START_TOMCAT}
echo "done."
}

stop() {
echo -n "Shutting down tomcat8: "
cd $TOMCAT_HOME
${STOP_TOMCAT}
echo "done."
}

case "$1" in

start)
start
;;

stop)
stop
;;

restart)
stop
sleep 10
start
;;

*)
echo "Usage: $0 {start|stop|restart}"

esac
exit 0

3. Change tomcat file permission
#chmod 755 tomcat

4. Run chkconfig command to add the script to the startup services
#chkconfig  tomcat on

5.Verify tomcat service
#service tomcat start
#service tomcat stop

source :

Tuesday, March 11, 2014

Owncloud : Set/change data directory

The guide.

  1. Stop your webserver

  2. Check if your config.php already contains a datadirectory entry. If it does, remember that location (let's assume it's '/var/www/owncloud/data' for now).

  3. Change or create the "datadirectory" entry in config.php file, so that it points to wherever you want to have your data from now on. Assuming the directory you want to move the data folder to is '/media/usbdisk/ocdata', your config.php should look like this after the change:
    CODE: SELECT ALL
    <?php
    $CONFIG = array (
    'datadirectory' => '/mnt/nfs/cloud/',
    'dbtype' => ...

  4. Move all the existing files of the original data (/var/www/owncloud/data in our example) to that new location (if there are any), e.g. under linux:
    CODE: SELECT ALL
    mv /var/www/owncloud/data/* /media/usbdisk/ocdata/

  5. Make sure the permission/ownership of the new folder is set up correctly, and that all files contained in it have the user running php as owner (see e.g. here for Linux how to find out which user that is). Let's assume your apache runs as "www-data" (as it e.g. would under Ubuntu). Then you should change all files to be owned by that user, like so:
    CODE: SELECT ALL
    chown -R www-data:www-data /media/usbdisk/ocdata

    Under Windows: Give the user IIUSR all permissions on the new data folder

  6. Start your webserver

  7. Possibly (if your files don't show up) you might have to rescan your files (see e.g. here or here on how to do that)


Source : https://forum.owncloud.org/viewtopic.php?t=7118

Wednesday, January 29, 2014

LDAP Issue

Problems:

Creating initial slapd configuration... Loading the initial configuration from the ldif file (/usr/share/slapd/slapd.init.ldif) failed with the following
error while running slapadd:
ldif_read_record: include file:///etc/ldap/schema/core.ldif failed


Solve:

  1. sudo apt-get purge slapd

  2. sudo apt-get install slapd ldap-utils