1
Ubuntu skolhjälp
Postat av Kaffepannan den 9 November 2012, 09:34
19 kommentarer · 442 träffar
Tja Fragbite igen. Har nu en sista uppgift i skolan att göra och jag fattar ingeting... aldrig användt ubuntu och förstår mig inte på de. Har försökt googla svaren men hittar ingeting vettigt så nu ber jag om jag hjälp. Om de finns någon snäll/kunnig själ där ute som förstår sig på Ubuntu så snälla hjälp mig med kommandona så jag kan bli av med detta.
Här kommer frågorna med vad man ska göra.
Question 1: What is i-node?
Do the following practices with hard and symbolic links.
Question 2: Create a text file named my-tmp.txt in the directory /tmp, with
the contents “this is a text file”.
Command:
Question 3: show the i-node number for /tmp/my-tmp.txt
Command:
Quest ion 4: create a hard link (named hlink) to /tmp/my-tmp.txt
Command:
Quest ion 5: show the i-node number for hlink? Why it is the same as the i-
node number for /tmp/my-tmp.txt?
Command:
Ques tion 6: create a symbolic link to /tmp/my-tmp.txt, and name it as slink.
Command:
Question 7: show the i-node number for slink. Is it the same i-node number
as for hlink (Question 5)?
Command:
Question 8: view the contents of my-tmp.txt via the symbolic link slink.
Command:
Question 9: Remove the file /tmp/my-tmp.txt
Command:
Quest ion 10: can you view the file slink? Why?
Command:
Question 11: can you view the file hlink? Why ?
Command:
Question 12: create a directory in /tmp and name it as mydir.
Command:
Question 13: try to create a hard link to /tmp/mydir? What message do you
get?
Question 14: create a symbolic link to /tmp/mydir, and name it sdir.
Command:
Question 15: change directory to sdir. What is your current directory now?
Commands:
Question 16: summarize your understanding about hard link and symbolic
link.
Question 17: What is bootstrap?
Question 18: what is boot loader (bootladdare)?
Init is the parent of all processes in a Linux system. Its process ID (or PID) is
1. Its primary role is to create processes based on the configuration file
/etc/inittab.
Question 19: what is init? And what is inittab?
Runlevels determine which processes (services) should run together. All
processes that can be started or stopped at a given runlevel are controlled by
a script (called an “init script” or an “rc script”) in the directory /etc/init.d.
Start (or stop) a process at a given runlevel is done by creating a symbolic
link in the /etc/rcN.d directory, where N is a runlevel. The script given in
/etc/init.d or /etc/rcN.d can be used to start or stop a process (service). In
Ubuntu system, the default runlevel is defined in the file /etc/init/rc-
sysinit.conf. If you go through the file, you can find a line
Env DEFAULT_RUNLEVEL=2
That means, the default runlevel is 2.
Read more description on init and runlevel by the command “man init” and
“man runlevel”.
.
Question 20: what are runlevel 1, runlevel 2 and runlevel 6?
Question 21: which runlevel is your system currently in?
Command:
Question 22: Use long list command to list the directory /etc/rc2.d. You will
find that it contains many symbolic links (to files in /etc/init.d).
Command:
Questio n 23: view and read the file contents in /etc/rcS.d/README
Command:
Que stion 24: if you want to disable a service at this level, how should you
do?
Question 25: change directory to /etc/init.d
Command:
In the directory, you can find the file Bluetooth. It is used to manage the
Bluetooth service in Ubuntu system (other services are similar). You can
check the service status, and start or stop the service by the command in the
form “sudo service bluetooth status” (status could be stop, or start).
Question 26: check the status of Bluetooh service
Command:
Question 27: stop the Bluetooth service
Command:
Question 28: check the status of Bluetooh service
Command:
Question 29: start the Bluetooth service again.
Command:
Question 30: how to list all your lab log files (for examples lab2.log,
lab3.log)?
Command:
3.2 Find files and search for text
Commands used: find, which, grep, cat, head, tail, more, less
Read “21.13 Filterverktyg”, pp.287—298, in the textbook.
The command find can be very useful when you want to find files satisfying
some criteria. The basic format is
find directory_to_start_find criteria
For example, following command can be used to find all files under the
current directory, that have been modified less than 1 day:
find . –mtime -1
Question 31: what does the command
find / -name “*.txt” 2> /dev/null do ?
Question 32: using grep to search for your account info in the file
/etc/passwd.
Command:
The command which is used to get the full path (absolute path name) to an
executable program by scanning the directories defined in the user’s PATH
environment variable. The value for the environment variable is access by
$environmentvariablename.
Question 33: Show the value for your environment variable PATH (tip: use
echo)
Command:
Question 34: find the full pathname for command passwd (tip: use which)
Command:
4. Log files
As a system administrator, you would need to check the log files to find any
problems in hardware or software in your system. So it is important for you to
be able to locate the main log files and view the log files. The location for the
log files is /var/log, and the most common commands to view the log files are
tail, more, less, grep. Most log files are not readable for common users and
you need to use sudo command to view them.
Question 35: change the directory to /var/log
Command:
Question 36: list the files in the directory. Can you find syslog, auth.log?
Command:
Question 37: what are log files syslog and auth.log?
In Ubuntu system, there is a GUI tool named gnome-system-log. You can
start it from terminal by the command
sudo gnome-system-log &
Question 38: why you need to use sudo? What is purpose of “&” in the
above command?
5. Backup
Question 39: Use tar to archive all your files under your user home directory.
Command:
Question 40: Use zip to compress your archived file obtained above.
Command:
Question 41: use command ls to list the directory. What is the zipped file
name?
Question 42: use gzip to compress your archived file obtained in Question
23. What is the file name after gzipping?
Command:
Question 43: use ls command to find the file sizes for compressed archived
file using zip and gzip. Compare their sizes? Which one is smaller?
Command:
Question 44: Copy the gzipped archive file to /tmp
Command:
Question 45: Restore your archive under /tmp.
Command(s):
6.1 Installation of SSH
SSH or secure shell is a secure communication protocol that allows you to
access the remote networked computer. It is a replacement for traditional
Telnet which sends data in plaintext. With SSH, the data traffic is encrypted.
If you install SSH server in your Ubuntu system, you can access the system
remotely in a secure way (you can even create an account for your friend and
allow him/her to share your system via SSH).
If your system has the Internet connection, you can use the following
command to download the Open SSH server and install it in your system:
sudo apt-get install openssh-server
Question 46: What is the IP address for your wireless connection?
Command:
Question 47: tell your classmate the user name (user1 created in lab 4) and
password. As the classmate to use SSH to login to your system as user1.
Command (of your classmate):
6.2 Installation of LAMP
Apache is the most popular web server, while MySQL is the most popular
database, and PHP is the one of the most popular server side scripting
language. LAMP (Linux, Apache, MySQL, PHP) is a common choice to
provide the web service.
Copy the following command to your Terminal, to install LAMP:
sudo apt-get install lamp-server^
during the installation, you are asked to create a root password for MySQL
server, you should create one and write down the password. This password
will be required in the future when you need to administrate the MySQL
server (MySQL can be used later in your database course).
When installation is completed, you can use the web browser to check if the
server is running by entering the address: localhost or 127.0.0.1. You can
also access the web server from any other computer by the IP address for
your wireless connection.
The web server configuration files are located in /etc/apache2 and the server
DocumentRoot is /var/ www. That is files in the directory /var/www will be
available to the web clients.
Här kommer frågorna med vad man ska göra.
Question 1: What is i-node?
Do the following practices with hard and symbolic links.
Question 2: Create a text file named my-tmp.txt in the directory /tmp, with
the contents “this is a text file”.
Command:
Question 3: show the i-node number for /tmp/my-tmp.txt
Command:
Quest ion 4: create a hard link (named hlink) to /tmp/my-tmp.txt
Command:
Quest ion 5: show the i-node number for hlink? Why it is the same as the i-
node number for /tmp/my-tmp.txt?
Command:
Ques tion 6: create a symbolic link to /tmp/my-tmp.txt, and name it as slink.
Command:
Question 7: show the i-node number for slink. Is it the same i-node number
as for hlink (Question 5)?
Command:
Question 8: view the contents of my-tmp.txt via the symbolic link slink.
Command:
Question 9: Remove the file /tmp/my-tmp.txt
Command:
Quest ion 10: can you view the file slink? Why?
Command:
Question 11: can you view the file hlink? Why ?
Command:
Question 12: create a directory in /tmp and name it as mydir.
Command:
Question 13: try to create a hard link to /tmp/mydir? What message do you
get?
Question 14: create a symbolic link to /tmp/mydir, and name it sdir.
Command:
Question 15: change directory to sdir. What is your current directory now?
Commands:
Question 16: summarize your understanding about hard link and symbolic
link.
Question 17: What is bootstrap?
Question 18: what is boot loader (bootladdare)?
Init is the parent of all processes in a Linux system. Its process ID (or PID) is
1. Its primary role is to create processes based on the configuration file
/etc/inittab.
Question 19: what is init? And what is inittab?
Runlevels determine which processes (services) should run together. All
processes that can be started or stopped at a given runlevel are controlled by
a script (called an “init script” or an “rc script”) in the directory /etc/init.d.
Start (or stop) a process at a given runlevel is done by creating a symbolic
link in the /etc/rcN.d directory, where N is a runlevel. The script given in
/etc/init.d or /etc/rcN.d can be used to start or stop a process (service). In
Ubuntu system, the default runlevel is defined in the file /etc/init/rc-
sysinit.conf. If you go through the file, you can find a line
Env DEFAULT_RUNLEVEL=2
That means, the default runlevel is 2.
Read more description on init and runlevel by the command “man init” and
“man runlevel”.
.
Question 20: what are runlevel 1, runlevel 2 and runlevel 6?
Question 21: which runlevel is your system currently in?
Command:
Question 22: Use long list command to list the directory /etc/rc2.d. You will
find that it contains many symbolic links (to files in /etc/init.d).
Command:
Questio n 23: view and read the file contents in /etc/rcS.d/README
Command:
Que stion 24: if you want to disable a service at this level, how should you
do?
Question 25: change directory to /etc/init.d
Command:
In the directory, you can find the file Bluetooth. It is used to manage the
Bluetooth service in Ubuntu system (other services are similar). You can
check the service status, and start or stop the service by the command in the
form “sudo service bluetooth status” (status could be stop, or start).
Question 26: check the status of Bluetooh service
Command:
Question 27: stop the Bluetooth service
Command:
Question 28: check the status of Bluetooh service
Command:
Question 29: start the Bluetooth service again.
Command:
Question 30: how to list all your lab log files (for examples lab2.log,
lab3.log)?
Command:
3.2 Find files and search for text
Commands used: find, which, grep, cat, head, tail, more, less
Read “21.13 Filterverktyg”, pp.287—298, in the textbook.
The command find can be very useful when you want to find files satisfying
some criteria. The basic format is
find directory_to_start_find criteria
For example, following command can be used to find all files under the
current directory, that have been modified less than 1 day:
find . –mtime -1
Question 31: what does the command
find / -name “*.txt” 2> /dev/null do ?
Question 32: using grep to search for your account info in the file
/etc/passwd.
Command:
The command which is used to get the full path (absolute path name) to an
executable program by scanning the directories defined in the user’s PATH
environment variable. The value for the environment variable is access by
$environmentvariablename.
Question 33: Show the value for your environment variable PATH (tip: use
echo)
Command:
Question 34: find the full pathname for command passwd (tip: use which)
Command:
4. Log files
As a system administrator, you would need to check the log files to find any
problems in hardware or software in your system. So it is important for you to
be able to locate the main log files and view the log files. The location for the
log files is /var/log, and the most common commands to view the log files are
tail, more, less, grep. Most log files are not readable for common users and
you need to use sudo command to view them.
Question 35: change the directory to /var/log
Command:
Question 36: list the files in the directory. Can you find syslog, auth.log?
Command:
Question 37: what are log files syslog and auth.log?
In Ubuntu system, there is a GUI tool named gnome-system-log. You can
start it from terminal by the command
sudo gnome-system-log &
Question 38: why you need to use sudo? What is purpose of “&” in the
above command?
5. Backup
Question 39: Use tar to archive all your files under your user home directory.
Command:
Question 40: Use zip to compress your archived file obtained above.
Command:
Question 41: use command ls to list the directory. What is the zipped file
name?
Question 42: use gzip to compress your archived file obtained in Question
23. What is the file name after gzipping?
Command:
Question 43: use ls command to find the file sizes for compressed archived
file using zip and gzip. Compare their sizes? Which one is smaller?
Command:
Question 44: Copy the gzipped archive file to /tmp
Command:
Question 45: Restore your archive under /tmp.
Command(s):
6.1 Installation of SSH
SSH or secure shell is a secure communication protocol that allows you to
access the remote networked computer. It is a replacement for traditional
Telnet which sends data in plaintext. With SSH, the data traffic is encrypted.
If you install SSH server in your Ubuntu system, you can access the system
remotely in a secure way (you can even create an account for your friend and
allow him/her to share your system via SSH).
If your system has the Internet connection, you can use the following
command to download the Open SSH server and install it in your system:
sudo apt-get install openssh-server
Question 46: What is the IP address for your wireless connection?
Command:
Question 47: tell your classmate the user name (user1 created in lab 4) and
password. As the classmate to use SSH to login to your system as user1.
Command (of your classmate):
6.2 Installation of LAMP
Apache is the most popular web server, while MySQL is the most popular
database, and PHP is the one of the most popular server side scripting
language. LAMP (Linux, Apache, MySQL, PHP) is a common choice to
provide the web service.
Copy the following command to your Terminal, to install LAMP:
sudo apt-get install lamp-server^
during the installation, you are asked to create a root password for MySQL
server, you should create one and write down the password. This password
will be required in the future when you need to administrate the MySQL
server (MySQL can be used later in your database course).
When installation is completed, you can use the web browser to check if the
server is running by entering the address: localhost or 127.0.0.1. You can
also access the web server from any other computer by the IP address for
your wireless connection.
The web server configuration files are located in /etc/apache2 and the server
DocumentRoot is /var/ www. That is files in the directory /var/www will be
available to the web clients.






