<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6996122982393355907</id><updated>2012-02-15T23:56:09.100-08:00</updated><title type='text'>All About Linux</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tutorials-linux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tutorials-linux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Marlon Budol Santos</name><uri>http://www.blogger.com/profile/03780682111916931019</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-8R28k6OSiWw/Tjf474OqENI/AAAAAAAAADI/p6zMTYJPU5s/s220/169016_1562346783071_1367384805_31286780_2248144_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6996122982393355907.post-7973204206542235424</id><published>2011-06-08T05:49:00.000-07:00</published><updated>2011-06-08T05:55:40.354-07:00</updated><title type='text'>How To Set Up MySQL Database Replication</title><content type='html'>&lt;span style="font-weight:bold;"&gt;***Configuring The Master (server1)***&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the MySQL shell, run the following commands:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;GRANT REPLICATION SLAVE ON *.* TO 'slavedb'@'%' IDENTIFIED BY 'slavepasswd';&lt;br /&gt;FLUSH PRIVILEGES;&lt;br /&gt;quit;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Furthermore we have to tell MySQL for which database it should write logs (these logs are used by the slave to see what has changed on the master), &lt;br /&gt;&lt;br /&gt;which log file it should use, and we have to specify that this MySQL server is the master. We want to replicate the database exampledb, so we &lt;br /&gt;&lt;br /&gt;add/enable the following lines in /etc/mysql/my.cnf (in the [mysqld]section):&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;vi /etc/mysql/my.cnf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;# The following can be used as easy to replay backup logs or for replication.&lt;br /&gt;# note: if you are setting up a replication slave, see README.Debian about&lt;br /&gt;#       other settings you may need to change.&lt;br /&gt;server-id           = 1&lt;br /&gt;log_bin             = /var/log/mysql/mysql-bin.log&lt;br /&gt;expire_logs_days    = 10&lt;br /&gt;max_binlog_size     = 100M&lt;br /&gt;binlog_do_db        = exampledb&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then restart MySQL:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;/etc/init.d/mysqld restart&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Next we lock the exampledb database on server1, find out about the master status of server1, create an SQL dump of exampledb (that we will import &lt;br /&gt;&lt;br /&gt;into exampledb on server2 so that both databases contain the same data), and unlock the database so that it can be used again: &lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mysql -u root -p&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On the MySQL shell, run the following commands:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;USE exampledb;&lt;br /&gt;FLUSH TABLES WITH READ LOCK;&lt;br /&gt;SHOW MASTER STATUS;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The last command should show something like this (please write it down, we'll need it later on): &lt;br /&gt;&lt;br /&gt;mysql&gt; SHOW MASTER STATUS;&lt;br /&gt;+------------------+----------+--------------+------------------+&lt;br /&gt;| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |&lt;br /&gt;+------------------+----------+--------------+------------------+&lt;br /&gt;| mysql-bin.000001 |       98 | exampledb    |                  |&lt;br /&gt;+------------------+----------+--------------+------------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now don't leave the MySQL shell, because if you leave it, the database lock will be removed, and this is not what we want right now because we must &lt;br /&gt;&lt;br /&gt;create a database dump now. While the MySQL shell is still open, we open a second command line window where we create the SQL dump &lt;br /&gt;&lt;br /&gt;snapshot.sql and transfer it to server2 (using scp; again, make sure that the root account is enabled on server2):&lt;br /&gt;&lt;br /&gt;server1:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;cd /tmp&lt;br /&gt;mysqldump -u root -pyourrootsqlpassword --opt exampledb &gt; snapshot.sql&lt;br /&gt;scp snapshot.sql root@192.168.0.101:/tmp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Afterwards, you can close the second command line window. On the first command line window, we can now unlock the database and leave the MySQL shell:&lt;br /&gt;&lt;br /&gt;server1:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;UNLOCK TABLES;&lt;br /&gt;quit;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;***Configuring The Slave (server2)***&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we must configure the slave. Open /etc/mysql/my.cnf and make sure you have the following settings in the [mysqld] section:&lt;br /&gt;&lt;br /&gt;server2:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;vi /etc/mysql/my.cnf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;server-id=2&lt;br /&gt;master-connect-retry=60&lt;br /&gt;replicate-do-db=exampledb&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The value of server-id must be unique and thus different from the one on the master!&lt;br /&gt;&lt;br /&gt;Restart MySQL afterwards:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;/etc/init.d/mysqld restart&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Before we start setting up the replication, we create an empty database exampledb on server2:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mysql -u root -p&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;CREATE DATABASE exampledb;&lt;br /&gt;quit;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On server2, we can now import the SQL dump snapshot.sql like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;/usr/bin/mysqladmin --user=root --password=yourrootsqlpassword stop-slave&lt;br /&gt;cd /tmp&lt;br /&gt;mysql -u root -pyourrootsqlpassword exampledb &lt; snapshot.sql&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now connect to MySQL again...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mysql -u root -p&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;... and run the following command to make server2 a slave of server1 (it is important that you replace the values in the following command with the values you got from the SHOW MASTER STATUS; command that we ran on server1!):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;CHANGE MASTER TO MASTER_HOST='192.168.0.100', MASTER_USER='slave_user', MASTER_PASSWORD='slave_password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=98;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;MASTER_HOST is the IP address or hostname of the master (in this example it is 192.168.0.100).&lt;br /&gt;MASTER_USER is the user we granted replication privileges on the master.&lt;br /&gt;MASTER_PASSWORD is the password of MASTER_USER on the master.&lt;br /&gt;MASTER_LOG_FILE is the file MySQL gave back when you ran SHOW MASTER STATUS; on the master.&lt;br /&gt;MASTER_LOG_POS is the position MySQL gave back when you ran SHOW MASTER STATUS; on the master. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Finally start the slave:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;START SLAVE;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then check the slave status:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;SHOW SLAVE STATUS \G&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It is important that both Slave_IO_Running and Slave_SQL_Running have the value Yes in the output (otherwise something went wrong, and you should &lt;br /&gt;&lt;br /&gt;check your setup again and take a look at /var/log/syslog to find out about any errors);&lt;br /&gt;&lt;br /&gt;mysql&gt; SHOW SLAVE STATUS \G&lt;br /&gt;*************************** 1. row ***************************&lt;br /&gt;             Slave_IO_State: Waiting for master to send event&lt;br /&gt;                Master_Host: 192.168.0.100&lt;br /&gt;                Master_User: slave_user&lt;br /&gt;                Master_Port: 3306&lt;br /&gt;              Connect_Retry: 60&lt;br /&gt;            Master_Log_File: mysql-bin.000001&lt;br /&gt;        Read_Master_Log_Pos: 98&lt;br /&gt;             Relay_Log_File: mysqld-relay-bin.000002&lt;br /&gt;              Relay_Log_Pos: 235&lt;br /&gt;      Relay_Master_Log_File: mysql-bin.000001&lt;br /&gt;           Slave_IO_Running: Yes&lt;br /&gt;          Slave_SQL_Running: Yes&lt;br /&gt;            Replicate_Do_DB: exampledb&lt;br /&gt;        Replicate_Ignore_DB:&lt;br /&gt;         Replicate_Do_Table:&lt;br /&gt;     Replicate_Ignore_Table:&lt;br /&gt;    Replicate_Wild_Do_Table:&lt;br /&gt;Replicate_Wild_Ignore_Table:&lt;br /&gt;                 Last_Errno: 0&lt;br /&gt;                 Last_Error:&lt;br /&gt;               Skip_Counter: 0&lt;br /&gt;        Exec_Master_Log_Pos: 98&lt;br /&gt;            Relay_Log_Space: 235&lt;br /&gt;            Until_Condition: None&lt;br /&gt;             Until_Log_File:&lt;br /&gt;              Until_Log_Pos: 0&lt;br /&gt;         Master_SSL_Allowed: &lt;br /&gt;         Master_SSL_CA_File: &lt;br /&gt;         Master_SSL_CA_Path:&lt;br /&gt;            Master_SSL_Cert: &lt;br /&gt;          Master_SSL_Cipher:&lt;br /&gt;             Master_SSL_Key: &lt;br /&gt;      Seconds_Behind_Master: 0&lt;br /&gt;1 row in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Afterwards, you can leave the MySQL shell on server2:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;quit;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it! Now whenever exampledb is updated on the master, all changes will be replicated to exampledb on the slave. Test it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6996122982393355907-7973204206542235424?l=tutorials-linux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tutorials-linux.blogspot.com/feeds/7973204206542235424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tutorials-linux.blogspot.com/2011/06/how-to-set-up-mysql-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/7973204206542235424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/7973204206542235424'/><link rel='alternate' type='text/html' href='http://tutorials-linux.blogspot.com/2011/06/how-to-set-up-mysql-database.html' title='How To Set Up MySQL Database Replication'/><author><name>Marlon Budol Santos</name><uri>http://www.blogger.com/profile/03780682111916931019</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-8R28k6OSiWw/Tjf474OqENI/AAAAAAAAADI/p6zMTYJPU5s/s220/169016_1562346783071_1367384805_31286780_2248144_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6996122982393355907.post-1616249173373286656</id><published>2011-06-07T05:28:00.000-07:00</published><updated>2011-06-07T05:40:43.436-07:00</updated><title type='text'>HOWTO: Setup a rsync server on Centos 5</title><content type='html'>These instructions assume that you have root access and are operating as the root user.  If you only have sudo access, just add sudo to the beginning of most of the commands.  The standard port for rsync which is 873 is assumed too.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Install xinetd and rsync packages&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;$ yum -y install xinetd rsync&lt;br /&gt;&lt;br /&gt;Make sure xinetd is running on levels 3, 4 and 5&lt;br /&gt;view sourceprint?&lt;br /&gt;$ chkconfig --level 345 xinetd on&lt;br /&gt;&lt;br /&gt;Modify rsync xinetd configuration, and change disable = yes to disable = no&lt;br /&gt;view sourceprint?&lt;br /&gt;$ vi /etc/xinetd.d/rsync&lt;br /&gt;&lt;br /&gt;Create rsync secrets file for passwords with format of username:password.&lt;br /&gt;view sourceprint?&lt;br /&gt;$ vi /etc/rsync.secrets&lt;br /&gt;&lt;br /&gt;Create configuration for rsync shares&lt;br /&gt;view sourceprint?&lt;br /&gt;$ vi /etc/rsync.conf&lt;br /&gt;&lt;br /&gt;Fix up permissions and ownership, and restart xinetd service&lt;br /&gt;view sourceprint?&lt;br /&gt;1.$ chown root.root /etc/rsyncd.*&lt;br /&gt;2.$ chmod 600 /etc/rsyncd.*&lt;br /&gt;3.$ service xinetd restart&lt;br /&gt;&lt;br /&gt;Test it out locally, you should get @RSYNCD:&lt;br /&gt;view sourceprint?&lt;br /&gt;$ telnet 127.0.0.1 873&lt;br /&gt;&lt;br /&gt;Test it out remotely, and here is where the fun begins.  Firewalls and settings stuff!&lt;br /&gt;&lt;br /&gt;SELinux (Security Enhanced Linux)&lt;br /&gt;&lt;br /&gt;Find out if selinux is running.  You can either look in the configuration file located at /etc/selinux/config or just try to look at the variable we are going to disable.&lt;br /&gt;&lt;br /&gt;$ sudo /usr/sbin/getsebool rsync_disable_trans&lt;br /&gt;&lt;br /&gt;rsync_disable_trans --&gt; off&lt;br /&gt;&lt;br /&gt;So this tells us that selinux is running and that rsync is being protected by selinux.  The on/off is a bit confusing, but off means nothing will get to your rsync daemon.  Let's change that.. and restart the xinetd service&lt;br /&gt;view sourceprint?&lt;br /&gt;1.$ setsebool -P rsync_disable_trans 1&lt;br /&gt;2.$ service xinetd restart&lt;br /&gt;&lt;br /&gt;IPTables Firewall&lt;br /&gt;&lt;br /&gt;Add an iptables entry for rsync's port.&lt;br /&gt;view sourceprint?&lt;br /&gt;$ vi /etc/sysconfig/iptables&lt;br /&gt;&lt;br /&gt;Add the following entry somewhere near the other protocols, but before the final drop line.&lt;br /&gt;view sourceprint?&lt;br /&gt;#&lt;br /&gt;# rsync - add entry to allow 192.168.0.* to connect to our rsync server.&lt;br /&gt;# &lt;br /&gt;-A INPUT -s 192.168.0.0/255.255.255.0 -p tcp -m tcp --dport 873 -j ACCEPT&lt;br /&gt;-A INPUT -p tcp -m tcp --dport 873 -j DROP&lt;br /&gt;&lt;br /&gt;You could also just run the iptables command and add the  rules then save it out.  Your choice.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Configuring /etc/rsyncd.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Being co-written by Andrew Tridgell, author of Samba, it's no surprise that Rsync's configuration file looks just like Samba (and Windows' :-), and that Rsync lets you create projects that look like shared directories under Samba. Accessing remote resources through this indirect channel offers more independence, as it lets you move files on the source Rsync server without changing anything on the destination host.&lt;br /&gt;&lt;br /&gt;Any parameters listed before any [module] section are global, default parameters.&lt;br /&gt;&lt;br /&gt;Each module is a symbolic name for a directory on the local host. Here's an example:&lt;br /&gt;&lt;br /&gt;    #/etc/rsyncd.conf&lt;br /&gt;    secrets file = /etc/rsyncd.secrets&lt;br /&gt;    motd file = /etc/rsyncd.motd #Below are actually defaults, but to be on the safe side...&lt;br /&gt;    read only = yes&lt;br /&gt;    list = yes&lt;br /&gt;    uid = nobody&lt;br /&gt;    gid = nobody&lt;br /&gt;&lt;br /&gt;    [out]&lt;br /&gt;    comment = Great stuff from remote.acme.com&lt;br /&gt;    path = /home/rsync/out&lt;br /&gt;&lt;br /&gt;    [confidential]&lt;br /&gt;    comment = For your eyes only&lt;br /&gt;    path = /home/rsync/secret-out&lt;br /&gt;    auth users = joe,jane&lt;br /&gt;    hosts allow = *.acme.com&lt;br /&gt;    hosts deny = *&lt;br /&gt;    list = false&lt;br /&gt;&lt;br /&gt;Note: Rsync will not grant access to a protected share if the password file (/etc/rsyncd.secrets, here) is world-readable. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Here's an example under Linux on how to set up a replication through SSH:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    rsync -avz -e ssh rsync@remote.acme.com:/home/rsync/out/ /home/rsync/from_remote &lt;br /&gt;&lt;br /&gt;An important thing here, is that the presence or absence of a trailing "/" in the source directory determines whether the directory itself is copied, or simply the contents of this source directory.&lt;br /&gt;&lt;br /&gt;In other words, the above means that the local host must have a directory available (here, /home/rsync/from_remote to receive the contents of /home/rsync/out sitting on the remote host, otherwise Rsync will happily download all files into the path given as destination without asking for confirmation, and you could end up with a big mess.&lt;br /&gt;&lt;br /&gt;On the other hand, rsync -avz -e ssh rsync@remote.acme.com:/home/rsync/out /home/rsync/from_remote means that the an "out" sub-directory is first created under /home/rsync/from_remote on the destination host, and will be populated with the contents of the remote directory ./out. In this case, files will be save on the local host in /home/rsync/from_remote/out, so the former commands looks like a better choice.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Here's how to replicate an Rsync share from a remote host:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    rsync -avz rsync@remote.acme.com::out /home/rsync/in &lt;br /&gt;&lt;br /&gt;Notice that we do not use a path to give the source resource, but instead just a name ("out"), and that we use :: to separate the server's name and the resource it offers. In the Rsync configuration that we'll see just below, this is shown as a [out] section. This way, admins on remote.acme.com can move files on their server; As long as they remember to update the actual path in the [out] section (eg. PATH=/home/rsync/out to PATH=/home/outgoing), remote Rsync users are not affected.&lt;br /&gt;&lt;br /&gt;An Rsync server displays the list of available anonymous shares through rsync remote.acme.com::. Note the ::. For added security, it is possible to prompt for a password when listing private shares, so that only authorized remote users know about the Rsync shares available from your server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Useful command-line switches&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    -v, --verbose increase verbosity&lt;br /&gt;    -q, --quiet decrease verbosity&lt;br /&gt;    -c, --checksum always checksum&lt;br /&gt;    -a, --archive archive mode. It is a quick way of saying you want recursion and want to preserve everything.&lt;br /&gt;    -r, --recursive recurse into directories&lt;br /&gt;    -R, --relative use relative path names&lt;br /&gt;    -u, --update update only (don't overwrite newer files)&lt;br /&gt;    -t, --times preserve times&lt;br /&gt;    -n, --dry-run show what would have been transferred&lt;br /&gt;    -W, --whole-file copy whole files, no incremental checks&lt;br /&gt;    -I, --ignore-times Normally rsync will skip any files that are already the same length and have the same time-stamp. This option turns off this behavior.&lt;br /&gt;    --existing only update files that already exist&lt;br /&gt;    --delete delete files that don't exist on the sending side&lt;br /&gt;    --delete-after delete after transferring, not before&lt;br /&gt;    --force force deletion of directories even if not empty&lt;br /&gt;    -c, --checksum always checksum&lt;br /&gt;    --size-only only use file size when determining if a file should be transferred&lt;br /&gt;    --progress show progress during transfer&lt;br /&gt;    -z, --compress compress file data&lt;br /&gt;    --exclude=PATTERN exclude files matching PATTERN&lt;br /&gt;    --daemon run as a rsync daemon&lt;br /&gt;    --password-file=FILE get password from FILE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6996122982393355907-1616249173373286656?l=tutorials-linux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tutorials-linux.blogspot.com/feeds/1616249173373286656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tutorials-linux.blogspot.com/2011/06/howto-setup-rsync-server-on-centos-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/1616249173373286656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/1616249173373286656'/><link rel='alternate' type='text/html' href='http://tutorials-linux.blogspot.com/2011/06/howto-setup-rsync-server-on-centos-5.html' title='HOWTO: Setup a rsync server on Centos 5'/><author><name>Marlon Budol Santos</name><uri>http://www.blogger.com/profile/03780682111916931019</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-8R28k6OSiWw/Tjf474OqENI/AAAAAAAAADI/p6zMTYJPU5s/s220/169016_1562346783071_1367384805_31286780_2248144_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6996122982393355907.post-5345627312382232320</id><published>2011-05-17T22:23:00.000-07:00</published><updated>2011-05-17T22:31:38.611-07:00</updated><title type='text'>Crontab</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;CRON is a unix, solaris utility that allows tasks to be automatically  run in the background at regular intervals by the cron daemon. These  tasks are often termed as cron jobs in unix , solaris.  Crontab (CRON  Table) is a file which contains the schedule of cron entries to be run  and at specified times.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:100%;"&gt;&lt;br /&gt;Put this script at /etc/crontad&lt;br /&gt;&lt;br /&gt;00 3 * * * root /sbin/reboot&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;------------------------------------------&lt;br /&gt;Other way&lt;br /&gt;------------------------------------------&lt;br /&gt;&lt;br /&gt;Cron is the process for executing commands at a scheduled time.&lt;br /&gt;Crontab is the facility to schedule cron jobs.&lt;br /&gt;Cron jobs can be run by any user, but because you want to reboot, you'll need to do this as root.&lt;br /&gt;&lt;br /&gt;Edit the cron table:&lt;br /&gt;# crontab -e&lt;br /&gt;&lt;br /&gt;Now you are in vi, editing the cron table. Add a line like:&lt;br /&gt;&lt;br /&gt;0 1 * * * shutdown -r now &amp;gt;/dev/null&lt;br /&gt;&lt;br /&gt;This command says, when the minute is 0 and the hour is 1, execute the command "shutdown -r now"&lt;br /&gt;and send any standard output to /dev/null (which cause the output to be thrown away).&lt;br /&gt;&lt;br /&gt;If you wanted this to happen on only Monday and Friday, you'd change one of the asterisks&lt;br /&gt;(first one I believe) to 1,5 (sunday is 0). Do a man on crontab for more details.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6996122982393355907-5345627312382232320?l=tutorials-linux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tutorials-linux.blogspot.com/feeds/5345627312382232320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tutorials-linux.blogspot.com/2011/05/crontab.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/5345627312382232320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/5345627312382232320'/><link rel='alternate' type='text/html' href='http://tutorials-linux.blogspot.com/2011/05/crontab.html' title='Crontab'/><author><name>Marlon Budol Santos</name><uri>http://www.blogger.com/profile/03780682111916931019</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-8R28k6OSiWw/Tjf474OqENI/AAAAAAAAADI/p6zMTYJPU5s/s220/169016_1562346783071_1367384805_31286780_2248144_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6996122982393355907.post-250850047429327163</id><published>2011-05-17T22:13:00.000-07:00</published><updated>2011-05-17T22:32:35.971-07:00</updated><title type='text'>How to add a swap file in Linux</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;In Linux, as in most other Unix-like operating systems, it is common to use a whole partition of a hard disk for swapping. However, with the 2.6 Linux kernel, swap files are just as fast[7] as swap partitions, although Red Hat recommends using a swap partition. The administrative flexibility of swap files outweighs that of partitions; since modern high capacity hard drives can remap physical sectors, no partition is guaranteed to be contiguous. You can add swap file as a dedicated partition or use following instructions to create a swap file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Procedure to add a swap file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;You need to use dd command to create swapfile. Next you need to use mkswap command to set up a Linux swap area on a device or in a file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;a) Login as the root user&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;b) Type following command to create 512MB swap file (1024 * 512MB = 524288 block size):&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;c) Set up a Linux swap area:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;# mkswap /swapfile1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;d) Activate /swapfile1 swap space immediately:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;# swapon /swapfile1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;# vi /etc/fstab&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;f) Append following line:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;/swapfile1 swap swap defaults 0 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So next time Linux comes up after reboot, it enables the new swap file for you automatically.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;g) How do I verify swap is activated or not?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Simply use free command:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;$ free -m&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6996122982393355907-250850047429327163?l=tutorials-linux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tutorials-linux.blogspot.com/feeds/250850047429327163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tutorials-linux.blogspot.com/2011/05/how-to-add-swap-file-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/250850047429327163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6996122982393355907/posts/default/250850047429327163'/><link rel='alternate' type='text/html' href='http://tutorials-linux.blogspot.com/2011/05/how-to-add-swap-file-in-linux.html' title='How to add a swap file in Linux'/><author><name>Marlon Budol Santos</name><uri>http://www.blogger.com/profile/03780682111916931019</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-8R28k6OSiWw/Tjf474OqENI/AAAAAAAAADI/p6zMTYJPU5s/s220/169016_1562346783071_1367384805_31286780_2248144_n.jpg'/></author><thr:total>0</thr:total></entry></feed>
