Open main menu

CDOT Wiki β

Changes

OPS235 Lab 3 - CentOS7

2,020 bytes added, 13:12, 29 March 2015
no edit summary
#Boot up your '''centos3''' VM.
#Change your working directory to <b><code><span style="color:#3366CC;font-size:1.2em;">/usr/share/doc/sudo*</span></code></b>#Use the tar (tape archiver) command to create an archive file named <codeb>/tmp/archive1.tar</codeb>#*<b><code><span style="color:#3366CC;font-size:1.2em;">tar cvf /tmp/archive1.tar .</span></code></b>
{{Admon/important | Warning! | Don't miss the '''.''' at the end of the <code>tar</code> commands below! It specifies what should go into the archive: the contents of the current directory.}}
<li>Compress the file using <code>gzip</code>:
<ul>
<li><b><code><span style="color:#3366CC;font-size:1.2em;">gzip /tmp/archive1.tar</span></code></b></li>
</ul>
</li>
<li>Make sure you're still in <code>/usr/share/doc/sudo*</code> and then create a compressed archive:
<ul>
<li><b><code><span style="color:#3366CC;font-size:1.2em;">tar cvzf /tmp/archive2.tgz .</span></code></b></li>
</ul>
</li>
<li>What does the <b><code><span style="color:#3366CC;font-size:1.2em;">z</span></code></b> option do?</li> <li>Compare the sizes of <b><code><span style="color:#3366CC;font-size:1.2em;">/tmp/archive1.tar.gz</span></code></b> and <codespan style="color:#3366CC;font-size:1.2em;">/tmp/archive2.tgz</span></code></b>. Why are they so close in size?</li>
</ol>
===Part 2: Restoring Files From an Archive===
{{Admon/note|Remain in your centos3 VM|Perform these steps in the '''centos3''' virtual machine.}}
#Create the directory <b><code><span style="color:#3366CC;font-size:1.2em;">/tmp/extract1</span></code></b>#Change to the <b><code><span style="color:#3366CC;font-size:1.2em;">/tmp/extract1</span></code></b> directory.
#Move the file archive1.tar.gz to your current directory.
#Unzip the first archive you created:
#*<b><code><span style="color:#3366CC;font-size:1.2em;">gunzip archive1.tar.gz</span></code></b>
#Extract the files from the first archive:
#*<b><code><span style="color:#3366CC;font-size:1.2em;">tar xvf archive1.tar</span></code></b>
#Are all the files there?
#Compare <b><code><span style="color:#3366CC;font-size:1.2em;">/tmp/extract1/README</span></code></b> and <codespan style="color:#3366CC;font-size:1.2em;">/usr/share/doc/sudo*/README</span></code></b>. Are they exactly the same? Why?#Create the directory <b><code><span style="color:#3366CC;font-size:1.2em;">/tmp/extract2</code>#Move the file archive2.tgz to the <codeb>/tmp/extract2</codeb> directory.
#Extract the files from the second archive:
#*<b><code><span style="color:#3366CC;font-size:1.2em;">tar xvzf /tmp/extract2/archive2.tgz</span></code></b>#Note that this time a separate <b><code><span style="color:#3366CC;font-size:1.2em;">gunzip</span></code></b> command was not needed. Why?
#Repeat the previous command, leaving out the option "z". Does it work? Why?
#Compare the <b><code><span style="color:#3366CC;font-size:1.2em;">README</span></code></b> file in this directory with the original file. Are they exactly the same?
'''Answer the Investigation 2 observations / questions in your lab log book.'''
<ol>
<li value="3">Go to the directory <code>/tmp</code></li>
<li>Use the <b><code><span style="color:#3366CC;font-size:1.2em;">>wget</span></code></b> command to download the "tar ball" that contains the source code for the NLED text editor. <code>wget</code> is a command-line tool to download files from the web using the http or ftp protocols.
<ul>
<li><code>wget http://cdot.senecac.on.ca/software/nled/nled_2_52_src.tgz</code></li>
</ul>
</li>
<li>Extract the files. Change to the newly-extracted directory (<b><code><span style="color:#3366CC;font-size:1.2em;">/tmp/nled-2.52</span></code></b>)</li> <li>Check to see if there is a file named <b><code><span style="color:#3366CC;font-size:1.2em;">configure</span></code></b>. If so, run it; if not, skip this step. (Most but not all source code archives contain this file)</li> <li>Check to see if there is a file named <b><code><span style="color:#3366CC;font-size:1.2em;">Makefile</span></code></b> or <b><code><span style="color:#3366CC;font-size:1.2em;">makefile</span></code></b>. If so, type the command:
<ul>
<li><b><code><span style="color:#3366CC;font-size:1.2em;">make</span></code></b></li> <li>Did the command work? Why? Use the <b><code><span style="color:#3366CC;font-size:1.2em;">yum</span></code></b> command to install the package '''gcc'''. What do you think the package ''gcc'' does?</li>
</ul>
<li>Reissue the <b><code><span style="color:#3366CC;font-size:1.2em;">make</span></code></b> command. Where you successful? What does <code>make</code> do?</li> <li>Issue the command as root: <b><code><span style="color:#3366CC;font-size:1.2em;">yum list ncurses</span></code></b>. What do you see? Issue the command at root: <code>yum search ncurses</code>. What do you observe?</li> <li>In this case, you need to install the ncurses development libraries as well. Issue the following command as root: <code>yum install ncurses-devel.x86_64</code>. Now issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">make</span></code></b></li>
<li>Some software distributed as source code can automatically install itself. Try this command:
<ul>
<li><b><code><span style="color:#3366CC;font-size:1.2em;">make install</span></code></b></li>
</ul>
</li>
<li>Most but not all source code archives include the capability of installing themselves this way.</li>
<li>If the command <code>make install</code> does not work (how can you tell? What command did you learn from ULI101 to confirm that this command cannot be run from the command line?), copy the <b><code><span style="color:#3366CC;font-size:1.2em;">nled</span></code></b> program manually:
<ul>
<li><b><code><span style="color:#3366CC;font-size:1.2em;">cp nled /usr/local/bin</span></code></b></li>
</ul>
</li>
<li>Test <b><code><span style="color:#3366CC;font-size:1.2em;">nled</span></code></b> to make sure it works.</li> <li>Why did copying the nled executable to '''/usr/local/bin ''' allow the nled command to be run by name anywhere in the command prompt?</li>
</ol>
<ol>
<li value="2">Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">yum install elinks</span></code></b> and answer <b><code><span style="color:#3366CC;font-size:1.2em;">y</code> to the question about installation.
<ol type="a">
<li>Where did ''yum'' get the elinks software?</li>
</li>
<li>Issue an RPM query to verify that elinks is installed. Record this command in your lab log-book.</li>
<li>Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">yum remove elinks</span></code></b></li>
<li>Issue an RPM query to verify that elinks is no longer installed. Record this command in your lab log-book.</li>
<li>Issue this command: <b><code><span style="color:#3366CC;font-size:1.2em;">yum info cups</span></code></b></li>
</ol>
::* Based on the result, do you think that cups is a useful package for your system? If not, try removing it.
13,420
edits