Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Lab 5.2RHCSA 10, Chapter 5

Copy, sync and reboot safely

Level
Easy
25 min
Machines
server1, server2
Status
Not started

Goal

Move files between the two servers with scp, sftp and rsync, and plan a reboot with a warning to users.

Before you start

  • Finish lab 5.1 first (key login from server1 to server2), or type the password when asked.

Tasks

  1. Copy /etc/hosts from server1 to /tmp/hosts-from-server1 on server2 with scp.
  2. Download /etc/os-release from server2 to your home folder on server1 with sftp.
  3. On server1, create the folder ~/site with three files. Synchronize it to /home/student/site-backup/ on server2 with rsync.
  4. Delete one file in ~/site and run the sync again so that the file is also removed on server2. First show what would happen without changing anything.
  5. Plan a reboot of server2 in 10 minutes with the message "Kernel update". Then cancel it.

Check your work

ssh student@server2 'ls -l /tmp/hosts-from-server1 ~/site-backup/'
ls -l ~/os-release

Hints

Show the hints
  • The remote part of an scp path is user@host:path.
  • In sftp, get downloads.
  • rsync: a slash at the end of the source copies the content; -n = dry run; --delete removes extra files.
  • shutdown -r +10 "message" and shutdown -c.

Solution

Show the solution
  1. scp to server2.
    scp /etc/hosts student@server2:/tmp/hosts-from-server1
  2. sftp download.
    sftp student@server2
    sftp> get /etc/os-release
    sftp> exit
  3. Make the files and sync them.
    mkdir -p ~/site && touch ~/site/{index,about,contact}.html
    rsync -av ~/site/ student@server2:/home/student/site-backup/
  4. Remove a file, dry run, then sync with delete.
    rm ~/site/about.html
    rsync -avn --delete ~/site/ student@server2:/home/student/site-backup/
    rsync -av --delete ~/site/ student@server2:/home/student/site-backup/
  5. Plan and cancel the reboot (as root on server2).
    shutdown -r +10 "Kernel update"
    shutdown -c

My notes

No notes yet.

Lessons for this lab

Commands in this lab