Basic steps to manage linux server

Linux

Assumptions:
Username – Student
Password – novell
root password – novell

1. Boot your Linux server and authenticate as your student user with a password of novell.
2. Open a terminal session.
3. Change to the root user account by entering su – and providing a password of novell.
4. Suppose you’ve been having trouble with your Linux server and you want to check the messages file for any entries with the term “error” in it. Complete the following:
a. At the shell prompt, enter grep -i error /var/log/messages.
Tip
Using the –i switch tells the grep utility to ignore case and find any instance of the search string in the specified file.
b. What error entries were you able to locate?
5. Suppose an error just occurred again on your system. You need to check the end of the messages file to see what happened.
a. At the shell prompt, enter tail /var/log/messages.
b. What are the last 10 messages recorded in the file?
6. You decide to capture messages as they are written to the messages file in an attempt to catch the error as it occurs. Complete the following:
a. At the shell prompt, enter tail -f /var/log/messages.
Note
The –f switch tells the tail utility to monitor the specified file for changes and display them onscreen as they occur.
b. Open a new terminal session.
c. At the shell prompt, enter su -.
d. Authenticate with a password of novell.
e. Log out of your superuser session by entering exit.
f. Check to see the messages displayed by the tail utility.
g. Exit tail by switching to the terminal session where it is running and pressing Ctrl+C.
7. Practice mounting and dismounting removable media by completing the following:
a. Make sure you have root access by entering whoami at the shell prompt. If you aren’t logged in as root, use the su command to switch to this user.
b. Insert your SUSE Linux CD in the server’s CD drive.
c. If it doesn’t automount, enter mount -t iso9660 /dev/cdrom/media/cdrom.
d. Access the files on the CD by entering cd /media/cdrom.
e. Generate a listing of files on the CD by entering ls.
f. Generate a detailed listing of the files on the CD by entering ls -l.
8. Practice managing files and directories by completing the following:
a. At the shell prompt, create a new directory named files in /tmp by entering mkdir /tmp/files.
b. Using either the ls or dir command, pick a file on the mounted CD to copy.
c. Copy this file to /tmp/files by entering cp ./file_name/tmp/files.
d. Change to the /tmp/files directory by entering cd/tmp/files.
e. Verify the file was copied by entering ls -l.
f. Delete the file you just copied by entering rm ./file_name.
g. Change to the root directory of the file system by entering cd /.
h. Delete the directory you created by entering rmdir /tmp/files.
i. If asked to confirm, enter y.
j. Dismount the CD by entering umount /dev/cdrom.
k. Remove the CD from the CD drive.
9. Practice editing files.

a. Change to the /tmp directory by entering cd/tmp.
b. Use vi to create a new text file by entering vi ./scriptfile.txt.
c. Enter Insert mode by pressing the Ins key.
d. Enter the following text in the file:

echo "Changing to the /var/log directory."
cd /var/log
echo "Running grep to check for errors."
grep -i error messages
cd /tmp
echo "The script is now finished."

e. Exit Insert mode and return to Command mode by pressing Esc.
f. Save the changes to the file by entering :exit.
g. Verify that the text of the file has been entered correctly by entering cat ./scriptfile.txt

 

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.