Using Manages packages in Linux
- Ankai Liang
- 10411998
- link: http://www.cs.stevens.edu/~jschauma/615/s17-hw3.html
CLI
Create instances
1 | ➜ ~ git:(master) ✗ aws ec2 run-instances --image-id ami-0187f76b --count 2 --instance-type t1.micro --key-name keypair3 --security-groups mysg |
The public DNS of two instances are:
ec2-54-226-229-126.compute-1.amazonaws.com
ec2-52-204-105-92.compute-1.amazonaws.com
Install nginx by package manager
According to the tutorial of Nginx,(https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)
I should create a file named /etc/yum.repos.d/nginx.repo
First time, I couldn’t modify the file in this documents. Use sudo
to create file.
1 | ➜ Documents git:(master) ✗ ssh -i p.pem fedora@ec2-54-226-229-126.compute-1.amazonaws.com |
nginx.repo’s content:
1 | [nginx] |
Then I try to use yum
, but the system told me I should use dnf.
1 | [fedora@ip-172-31-19-227 ~]$ yum |
Binary Packages Q & A
- How many packages were added?
A: 52 packages. (sudo dnf install nginx) - How many new files were added?
A: I install the packages around the system time ‘Mon Feb 20 07:40:11 2017’
I usefind
to count how many new files were added.So when install system create around 27490-24766=2724 files1
2
3
4
5
6
7
8
9
10
11
12
13
14[fedora@ip-172-31-19-227 dnf]$ date
Mon Feb 20 09:01:50 UTC 2017
[fedora@ip-172-31-19-227 dnf]$ sudo find / -cmin -100 | grep '\/' -c
find: ‘/proc/9625/task/9625/fd/6’: No such file or directory
find: ‘/proc/9625/task/9625/fdinfo/6’: No such file or directory
find: ‘/proc/9625/fd/5’: No such file or directory
find: ‘/proc/9625/fdinfo/5’: No such file or directory
27490
[fedora@ip-172-31-19-227 dnf]$ sudo find / -cmin -70 | grep '\/' -c
find: ‘/proc/9635/task/9635/fd/6’: No such file or directory
find: ‘/proc/9635/task/9635/fdinfo/6’: No such file or directory
find: ‘/proc/9635/fd/5’: No such file or directory
find: ‘/proc/9635/fdinfo/5’: No such file or directory
24766 - Are all added packages necessary to run the software?
A: Yes they are. (infer from this sentence ‘Dependencies resolved.’) - Which version of nginx did you end up with?
A: Version : 1.8.1 (sudo dnf info nginx) - Which directories did the software get installed into?
A: /usr/sbin/nginx (which nginx) - How do you know you didn’t get any backdoors installed?
A: Check the file ‘dnf.cof’, I found ‘gpgcheck = 1’.
That means every timednf
download package from repo, it will run ‘GNU Private Guard’ checking, and make sure the resource of this package is safe and vaild.
1 | [fedora@ip-172-31-19-227 dnf]$ whereis dnf |
1 | [main] |
Build manually from source
SSH to the second instance。
From the tutorial, find the link of stable nginx source. Copy link.
1 | ➜ Documents git:(master) ✗ ssh -i p.pem fedora@ec2-52-204-105-92.compute-1.amazonaws.com |
Notice: After extracting the source, there are 75 files added.
1 | [fedora@ip-172-31-22-54 nginx-1.9.9]$ ./configure |
System need C compiler.
1 | [fedora@ip-172-31-22-54 nginx-1.9.9]$ sudo dnf install gcc |
1 | [fedora@ip-172-31-22-54 nginx-1.9.9]$ ./configure |
System need make
package
1 | [fedora@ip-172-31-22-54 nginx-1.9.9]$ make |
Add /usr/local/nginx to the $PATH.
1 | [fedora@ip-172-31-22-54 sbin]$ vi ~/.bashrc |
add these at the end of file:
export PATH=$PATH:/usr/local/nginx/sbin
Build manually from source Q&A
- What additional software did you have to install?
- A: gcc, make
- How did you install these pre-requisites? Can you do this without using any package manager at all (i.e. everything from source)?
- A: I use dnf install gcc and make. Maybe I can, but there are too many packages are related. It’s a really heavy work.
- How many new files were added?
- A: Around Mon Feb 20 09:45:08 2017 , added
gcc
.
Use the same way like above.
1 | [fedora@ip-172-31-22-54 sbin]$ sudo find / -cmin -50 | grep '\/' -c |
So there are about 11154-6422+75=2870 new files.
- Did this software use any of the added packages you had installed in the previous step? Why / why not?
- A: Yes, the software command
configure
need C compiler to compile and run.
Then need toolmake
to create Makefile and set file environment.
- Does this version of the software have feature parity with the binary package above? Are there some features enabled in one version that are not enabled in the other?
- A: No. When I use
configure
, the system told me can’t run these two modules:
http_rewrite_module, http_gzip_module.
Because there are not PCRE library and zilb library. The first instance didn’t tell me that.
Which directories did the software get installed into?
A: /usr/local/nginx. (refer from tutorial)
How do you know you didn’t get any backdoors installed?
If we install manually from source, we only rely on the trust of source.A: I can use command
top
andnetstat
to check if there is suspicious progress running or port has been occupied. But it’s still not a reliable method.