샤인의 IT (막 적는) 메모장

[Linux] Package & Service 본문

Cloud Infra/Linux

[Linux] Package & Service

신샤인 2022. 1. 15. 14:41
반응형

Redhat 리눅스 계열 기준!(CentOS 실습)

 

 

Package

 

#RPM
[root@localhost sudoers.d]# curl https://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/tree-1.6.0-10.el7.x86_64.rpm -o tree-1.6.0-10.el7.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 47508  100 47508    0     0  19180      0  0:00:02  0:00:02 --:--:-- 19179

[root@localhost ~]# rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:tree-1.6.0-10.el7                ################################# [100%]

#rpm 설치 시 dependancy 문제
[root@localhost ~]# rpm -ivh httpd-2.4.6-95.el7.centos.x86_64.rpm
error: Failed dependencies:
        /etc/mime.types is needed by httpd-2.4.6-95.el7.centos.x86_64
        httpd-tools = 2.4.6-95.el7.centos is needed by httpd-2.4.6-95.el7.centos.x86_64
        libapr-1.so.0()(64bit) is needed by httpd-2.4.6-95.el7.centos.x86_64
        libaprutil-1.so.0()(64bit) is needed by httpd-2.4.6-95.el7.centos.x86_64

#rpm 설치 패키지 확인
[root@localhost ~]# rpm -qa
openssh-server-7.4p1-21.el7.x86_64
setup-2.8.71-11.el7.noarch
authconfig-6.2.8-30.el7.x86_64
...

#rpm 설치 패키지 정보 세부 확인
[root@localhost ~]# rpm -qi tree
Name        : tree
Version     : 1.6.0
Release     : 10.el7
Architecture: x86_64
Install Date: Fri 14 Jan 2022 02:42:18 PM UTC
Group       : Applications/File
Size        : 89505
License     : GPLv2+
Signature   : RSA/SHA256, Fri 04 Jul 2014 05:36:46 AM UTC, Key ID 24c6a8a7f4a80eb5
Source RPM  : tree-1.6.0-10.el7.src.rpm
Build Date  : Mon 09 Jun 2014 07:28:53 PM UTC
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://mama.indstate.edu/users/ice/tree/
Summary     : File system tree viewer
Description :
The tree utility recursively displays the contents of directories in a
tree-like format.  Tree is basically a UNIX port of the DOS tree
utility.

#dependancy 문제를 해결한 yum
# yum을 통해 설치 시 해당 dependancy 패키지를 같이 설치함

#/etc/yum.repos.d에서 REPO 정보를 확인할 수 있음
[root@localhost yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#yum REPO 검색
[root@localhost yum.repos.d]# yum search httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.navercorp.com
 * epel: ftp.iij.ad.jp
 * extras: mirror.navercorp.com
 * updates: mirror.navercorp.com
====================================================================== N/S matched: httpd =======================================================================
dmlite-apache-httpd.x86_64 : Apache HTTPD frontend for dmlite
iipsrv-httpd-fcgi.noarch : Apache HTTPD files for iipsrv
keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
libmicrohttpd-devel.i686 : Development files for libmicrohttpd
libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd

 

Service

 

#daemon을 통해 httpd(apache) 서비스 테스트
[root@localhost yum.repos.d]# yum install httpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.navercorp.com
 * epel: ftp.iij.ad.jp
 * extras: mirror.navercorp.com
 * updates: mirror.navercorp.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos.2 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos.2 for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-7.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.2 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================
 Package                               Arch                             Version                                          Repository                         Size
=================================================================================================================================================================
Installing:
 httpd                                 x86_64                           2.4.6-97.el7.centos.2                            updates                           2.7 M
Installing for dependencies:
 apr                                   x86_64                           1.4.8-7.el7                                      base                              104 k
 apr-util                              x86_64                           1.5.2-6.el7                                      base                               92 k
 httpd-tools                           x86_64                           2.4.6-97.el7.centos.2                            updates                            94 k
 mailcap                               noarch                           2.1.41-2.el7                                     base                               31 k

Transaction Summary
=================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 3.0 M
Installed size: 10 M
Downloading packages:
(1/5): mailcap-2.1.41-2.el7.noarch.rpm                                                                                                    |  31 kB  00:00:00
(2/5): apr-1.4.8-7.el7.x86_64.rpm                                                                                                         | 104 kB  00:00:00
(3/5): httpd-2.4.6-97.el7.centos.2.x86_64.rpm                                                                                             | 2.7 MB  00:00:00
(4/5): apr-util-1.5.2-6.el7.x86_64.rpm                                                                                                    |  92 kB  00:00:02
(5/5): httpd-tools-2.4.6-97.el7.centos.2.x86_64.rpm                                                                                       |  94 kB  00:00:03
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                            936 kB/s | 3.0 MB  00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : apr-1.4.8-7.el7.x86_64                                                                                                                        1/5
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                                                   2/5
  Installing : httpd-tools-2.4.6-97.el7.centos.2.x86_64                                                                                                      3/5
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                                                   4/5
  Installing : httpd-2.4.6-97.el7.centos.2.x86_64                                                                                                            5/5
  Verifying  : httpd-2.4.6-97.el7.centos.2.x86_64                                                                                                            1/5
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                                                   2/5
  Verifying  : apr-1.4.8-7.el7.x86_64                                                                                                                        3/5
  Verifying  : httpd-tools-2.4.6-97.el7.centos.2.x86_64                                                                                                      4/5
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                                                   5/5

Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos.2

Dependency Installed:
  apr.x86_64 0:1.4.8-7.el7         apr-util.x86_64 0:1.5.2-6.el7         httpd-tools.x86_64 0:2.4.6-97.el7.centos.2         mailcap.noarch 0:2.1.41-2.el7

Complete!
[root@localhost yum.repos.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:httpd(8)
           man:apachectl(8)
#서비스 시작
[root@localhost yum.repos.d]# systemctl start httpd
#서비스 상태 확인
[root@localhost yum.repos.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-01-14 14:56:00 UTC; 5s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 2613 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─2613 /usr/sbin/httpd -DFOREGROUND
           ├─2614 /usr/sbin/httpd -DFOREGROUND
           ├─2615 /usr/sbin/httpd -DFOREGROUND
           ├─2616 /usr/sbin/httpd -DFOREGROUND
           ├─2617 /usr/sbin/httpd -DFOREGROUND
           └─2618 /usr/sbin/httpd -DFOREGROUND

Jan 14 14:56:00 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Jan 14 14:56:00 localhost.localdomain httpd[2613]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localh... message
Jan 14 14:56:00 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
#서비스 재시작
[root@localhost yum.repos.d]# systemctl restart httpd

#부팅 시 서비스가 자동으로 재시작하도록 설정할 경우
[root@localhost yum.repos.d]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

#해당 서비스 확인
[root@localhost yum.repos.d]# cat /etc/systemd/system/multi-user.target.wants/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
#설정 명령어
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target
반응형

'Cloud Infra > Linux' 카테고리의 다른 글

[Linux] Process & Archive  (0) 2022.01.15
[Linux] User Group & Permission  (0) 2022.01.15
[Linux] File Type & IO Redirection  (0) 2022.01.15
[Linux] 기본 명령어 정리  (0) 2022.01.15
[Linux] Rocky Linux 설치  (0) 2021.05.15
Comments