클 라 우 드 컴 퓨 팅 실전 시리즈 11 (패키지 관리)
12864 단어 클 라 우 드 컴 퓨 팅 그룹 Q: 784324747
지식 포인트:
구분 방식, 바 이 너 리 패키지 의 이름 은 보통 길 고 버 전 번호, 적응 플랫폼, 적응 하 는 하드웨어 유형 등 이 있 으 며 소스 패 키 지 는 버 전 번호 와 압축 형식 접미사 만 있 습 니 다.
shell ( ) RedHat/Centos RPM rpm,rpmbuild yum Ubuntu/Debian DPKG dpkg apt : , , !
RPM :
ntfs-3g-2011.4.12-5.el5.x86_64.rpm
ntfs-3g-2011.4.12-5.el6.i686.rpm
ntfs-3g-2011.4.12-5.el6.x86_64.rpm
yum-rhn-plugin-0.9.1-40.el6.noarch.rpm
yum-utils-1.1.30-14.el6.noarch.rpm
mysql-community-common-5.7.12-1.el7.i686.rpm
mysql-community-common-5.7.12-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.12-1.el6.x86_64.rpm
php-5.6.20-1.fc23.x86_64.rpm
ntfs-3g 2011.4.12 5.el5 x86_64.rpm
ntfs-3g 2011.4.12 5.el6 i686.rpm
yum-utils 1.1.30 14.el6 noarch
php 5.6.20 1.fc23 x86_64
[root@newrain ~]# uname -m
x86_64
[root@newrain ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
[root@newrain ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
yum 소스 관리
yum :http://mirrors.aliyun.com/
yum :http://mirrors.163.com
Base/Extras/Updates: ( , )
[root@newrain ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo CentOS-Debuginfo.repo CentOS-Sources.repo
[root@newrain ~]# yum repolist
repo id repo name status
base/7/x86_64 CentOS-7 - Base 9363
extras/7/x86_64 CentOS-7 - Extras 449
updates/7/x86_64 CentOS-7 - Updates 2146
repolist: 11,958
aliyun、163 yum
[root@newrain ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@newrain ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 183k 0 --:--:-- --:--:-- --:--:-- 189k
#[root@newrain ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo \
#http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@newrain ~]# yum clean all # yum
[root@newrain ~]# yum makecache #
EPEL:
[root@newrain ~]# yum install -y epel-release
[root@newrain ~]# mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
[root@newrain ~]# wget -O /etc/yum.repos.d/epel.repo \ http://mirrors.aliyun.com/repo/epel-7.repo aliyun epel
:
[root@newrain yum.repos.d]# vim nginx.repo
[nginx] ,
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
:
gpgcheck GPG ,1 ,0 , ;
enabled=1 yum 。
MySQL:
yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
[root@newrain ~]#yum repolist all | grep mysql mysql
[root@newrain ~]#yum -config-manager --enable mysql-community yum
[root@newrain ~]# yum -y install mysql-community-server
[root@newrain ~]# systemctl start mysqld
[root@newrain ~]# systemctl enable mysqld
Zabbix:
[root@newrain ~]# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
[root@newrain ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3. yum 관리 rpm 패키지
:
[root@newrain ~]# yum clean all //
[root@newrain ~]# yum makecache #fast //
[root@newrain ~]# yum repolist //
[root@newrain ~]# yum -y install httpd vsftpd
[root@newrain ~]# yum -y reinstall httpd
[root@newrain ~]# yum -y update httpd
[root@newrain ~]# yum -y install php
[root@newrain ~]# yum -y update ( , )
[root@newrain ~]# yum -y install /root/OpenIPMI-2.0.19-11.el7.x86_64.rpm //
[root@newrain ~]# yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm //URL
[root@newrain ~]# yum groupinfo mariadb
[root@newrain ~]# yum -y groupinstall mariadb
[root@newrain ~]# yum -y remove httpd # yum erase
[root@newrain ~]# yum -y groupremove mariadb
( rpm yum )
[root@newrain ~]# yum list httpd rpm
[root@newrain ~]# yum list |grep vnc
[root@newrain ~]# yum list installed
[root@newrain ~]# yum info httpd rpm
[root@newrain ~]# yum group list
[root@newrain ~]# yum grouplist
[root@newrain ~]# yum groupinfo mariadb
[root@newrain ~]# yum -y remove mysql-server
[root@newrain ~]# yum -y groupremove mysql-server
history
[root@newrain ~]# yum history
:
1: chinese
[root@newrain ~]# yum list |grep chinese //
[root@newrain ~]# yum list |grep piny
[root@newrain ~]# yum search chinese //
cjkuni-ukai-fonts.noarch : Chinese Unicode TrueType font in Kai face
cjkuni-uming-fonts.noarch : Chinese Unicode TrueType font in Ming face
[root@newrain ~]# yum search "http server"
[root@newrain ~]# yum search "web server"
2: /etc/vsftpd/vsftpd.conf ?
[root@newrain ~]# yum provides /etc/vsftpd/vsftpd.conf
Loaded plugins: langpacks
vsftpd-3.0.2-9.el7.x86_64 : Very Secure Ftp Daemon
Repo : classroom_content_rhel7.0_x86_64_dvd_
Matched from:
Filename : /etc/vsftpd/vsftpd.conf
[root@newrain ~]# yum -y install vsftpd-3.0.2-9.el7.x86_64
3: vsftpd.conf ?
[root@newrain ~]# yum provides *vsftpd/vsftpd.conf
[root@newrain ~]# yum provides */vsftpd.conf
[root@newrain ~]# yum provides */vsftpd.*
4: gnuplot ?
[root@newrain ~]# gnuplot
bash: gnuplot: command not found...
[root@newrain ~]# yum provides gnuplot
Loaded plugins: langpacks
gnuplot-4.6.2-3.el7.x86_64 : A program for plotting mathematical expressions and data
Repo : classroom_content_rhel7.0_x86_64_dvd
5: pip ?
[root@newrain ~]# pip
bash: pip: command not found...
[root@newrain ~]# yum -y install pip
6: vim ?
[root@newrain ~]# yum provides vim
4. RPM 공구 꾸러미 관리
rpm :
[root@newrain ~]# rpm -ivh
-i install
-vh verbose human
[root@newrain ~]# rpm -ivh lftp-4.0.9-1.el6.x86_64.rpm
:
[root@newrain ~]# rpm :
[root@newrain ~]# rpm -qf /etc/passwd
setup-2.8.14-20.el6.noarch
[root@newrain ~]# rpm -qf /bin/rpm
rpm-4.8.0-32.el6.x86_64-ql
-q query
-l list
[root@newrain ~]# rpm -ql lftp-4.0.9-1.el6.x86_64
:----------> 。
[root@newrain ~]# rpm -qa
[root@newrain ~]# rpm -qa | grep lftp
lftp-4.0.9-1.el6.x86_64
-a all
:
[root@newrain ~]# rpm -qi
[root@newrain ~]# rpm -qi gedit-2.28.4-3.el6.x86_64
-i information
:
[root@newrain ~]# rpm -qf /etc/passwd
setup-2.8.14-20.el6.noarch
[root@newrain ~]# rpm -qf /bin/rpm
rpm-4.8.0-32.el6.x86_64
-f file
[root@newrain ~]# rpm -qc
[root@newrain ~]# rpm -e
-e erase
--force ( )
--nodeps (
5. 기업 사례 실전
1. rpm
[root@newrain ~]# mkdir /root/yumdir
2. yum
[root@newrain ~]# cp /root/yumdir
3.
[root@newrain ~]#createrepo /root/yumdir # ,
4. yum
[root@newrain ~]# vim /etc/yum.repos.d/myyum.repo
[myyum]
name=myyum repo
baseurl=file:///root/yumdir/
gpgcheck=0
enabled=1
rpm 소프트웨어 제공 조직, 예 를 들 어 redhat 가 rpm 패 키 지 를 구축 할 때 개인 키 (private key) 를 사용 하여 rpm 에 서명 하 는 client 는 rpm 패 키 지 를 사용 할 때 합 법성 을 검증 하기 위해 redhat 가 제공 하 는 공개 키 (Public key) 를 사용 하여 서명 검 사 를 할 수 있 습 니 다.
:
[root@newrain ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@newrain ~]# vim /etc/yum.repos.d/CentOS-Base.repo
[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
:
[root@newrain ~]# vim /etc/yum.repos.d/CentOS-Base.repo
[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
7. 소스 패키지 관리
1.
,
Apache: www.apache.org
Nginx: www.nginx.org
Tengine: tengine.taobao.org
2. :
1. ,
#wget http://archive.apache.org/dist/apr/apr-1.6.5.tar.gz
#wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
#wget http://archive.apache.org/dist/httpd/httpd-2.4.38.tar.gz
#
#yum -y install ncurses ncurses-devel expat-devel openssl-devel bison gcc gcc-c++ make
2.
#tar xf /root/httpd-2.4.38.tar.bz2
#tar xf /root/apr-1.6.5.tar.gz
#tar xf /root/apr-util-1.6.1.tar.gz
3.cd ,
# apr
cd /root/apr-1.6.5
./configure --prefix=/usr/local/apr
make && make install
# apr-util
cd /root/apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
# httpd
cd httpd-2.4.37
./configure \
--prefix=/usr/local/apache/ \
--with-apr=/usr/local/apr/ \
--with-apr-util=/usr/local/apr-util/ \
--enable-so \
--enable-ssl\
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--enable-static-support
make && make install
#configurl
#make
#make install
:
mysql:
#
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz
1.
# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make
cmake:
# yum -y install cmake
boost:
# wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
mysql:
[root@mysql1 mysql-5.7.19]# pwd
/root/mysql-5.7.19
[root@mysql1 mysql-5.7.19]# tar xf /root/boost_1_59_0.tar.gz
3.
userdel -r mysql
yum -y remove mariadb mariadb-lib mariadb-server mariadb-devel
rm -rf /etc/my*
rm -rf /var/lib/mysql
useradd mysql -M -s /sbin/nologin
[[email protected] ~]# cmake . \
-DWITH_BOOST=boost_1_59_0/ \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ #
-DSYSCONFDIR=/etc \ # , etc
-DMYSQL_DATADIR=/usr/local/mysql/data \ #
-DINSTALL_MANDIR=/usr/share/man \ #
-DMYSQL_TCP_PORT=3306 \ # 3306
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ # ,
-DDEFAULT_CHARSET=utf8 \ #
-DEXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE=1 \ #
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \ #
-DENABLED_LOCAL_INFILE=1 \ #
-DWITH_INNOBASE_STORAGE_ENGINE=1 #
:boost
-DDOWNLOAD_BOOST=1
# make
# make install
:
2.
[root@mysql1 local]# cd mysql
[root@mysql1 mysql]# mkdir mysql-files
[root@mysql1 mysql]# chown -R mysql.mysql .
[root@mysql1 mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data ,
mysql
[root@mysql1 mysql]# vim /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
validate_password=off
MySQL- mysqld_safe
[root@mysql1 mysql]# bin/mysqld_safe --user=mysql &
[root@mysql1 bin]#./bin/mysqladmin -u root -p' ' password 123
[root@mysql1 bin]#./bin/mysql -u root -p ' '
8. 기업 컴 파일 설치 원본 문서 (이해)
apache :http://note.youdao.com/noteshare?id=b7a5d089db3bf0492783b3eec2fb565d
nginx :http://note.youdao.com/noteshare?id=e4ea631878f159aa8306db07d9018484
zabbix :http://note.youdao.com/noteshare?id=a509a3012e2dd30d97845eeb86e306e3