반응형
Selinux disabled
vi /etc/selinux/config
...
SELINUX=disabled
...
reboot
Yum Repository 복제
# 구축하고 싶은 repository 복제
vi /etc/yum.repos.d/docker-ce.repo
...
[docker-ce]
name=Docker-CE Repository
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
keepcache=0
gpgkey=https://download.docker.com/linux/centos/gpg
...
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum clean all
yum repolist
# 복제를 나누어서 하는 이유는 한번에 할 경우 "쪽"이 나면서 다운로드가 실패 가능성이 있음
# 1차로 복제 구축 시작
reposync -g -l -d -m --repoid=base --downloadcomps --download-metadata --download_path=/repo/
reposync -g -l -d -m --repoid=centosplus --downloadcomps --download-metadata --download_path=/repo/
reposync -g -l -d -m --repoid=extras --downloadcomps --download-metadata --download_path=/repo/
reposync -g -l -d -m --repoid=updates --downloadcomps --download-metadata --download_path=/repo/
# epel 설치
yum install epel-release -y
yum clean all
yum repolist
yum update -y
# gpg key import 필수
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
reposync -g -l -d -m --repoid=epel --downloadcomps --download-metadata --download_path=/repo/
sudo yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm
yum clean all
yum repolist
yum update -y
# gpg key import
sudo rpm --import https://repo.saltproject.io/py3/redhat/7/x86_64/3000/SALTSTACK-GPG-KEY.pub
# 해당 repo에 python pip lib 있음
reposync -g -l -d -m --repoid=salt-latest --downloadcomps --download-metadata --download_path=/repo/
sudo yum install https://repo.ius.io/ius-release-el7.rpm
yum clean all
yum repolist
yum update -y
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7
# 해당 repo에는 python3 install 있음
reposync -g -l -d -m --repoid=ius --downloadcomps --download-metadata --download_path=/repo/
# gpg key import (해당 url 브라우져에서 다운로드 되면 gpg 키등록 됨)
rpm --import https://download.docker.com/linux/centos/gpg
reposync -g -l -d -m --repoid=docker-ce --downloadcomps --download-metadata --download_path=/repo
# gpg key import (해당 url 브라우져에서 다운로드 되면 gpg 키등록 됨)
rpm --import https://packages.cloud.google.com/yum/doc/yum-key.gpg
rpm --import https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
reposync -g -l -d -m --repoid=kubernetes --downloadcomps --download-metadata --download_path=/repo
Createrepo를 하기 위해 필요한 lib 설치
sudo -i
mkdir /local-yum
cd /local-yum
yum install --downloadonly --downloaddir=./ createrepo httpd yum-utils
yum localinstall ./* -y
Repo 생성
# httpd 또는 nginx를 선택 할 것
# 옵션 1: httpd (web server 설정 진행)
vi /etc/httpd/conf.d/httpd.conf
...
DocumentRoot "/repo"
<Directory "/repo">
AllowOverride None
Require all granted
</Directory>
...
systemctl restart httpd
# 옵션 2: nginx 를 이용할 때에는
vi /etc/nginx/conf.d/repo.conf
...
server {
listen 80;
server_name _;
root /repo;
location / {
index index.php index.html index.htm;
autoindex on;
}
}
...
mkdir /repo
createrepo /repo
createrepo -g comps.xml /repo/base/
createrepo /repo/centosplus/
createrepo /repo/docker-ce/
createrepo /repo/epel/
createrepo /repo/extras/
createrepo /repo/ius/
createrepo /repo/kubernetes
createrepo /repo/salt-latest
createrepo /repo/updates
# check
curl -v http://192.168.201.200/base/repodata/repomd.xml
Offline 에서는 위 Download 한 yum repo 폴더를 tar 파일을 이용하여 repo 구축
reposync OPTIONS
-h, --help
Display a help message, and then quit.
-c CONFIG, --config=CONFIG
Config file to use (defaults to /etc/yum.conf).
-a ARCH, --arch=ARCH
Act as if running the specified arch (default: current
arch, note: does not override $releasever. x86_64 is a
superset for i*86.).
--source
Also download .src.rpm files.
-r REPOID, --repoid=REPOID
Specify repo ids to query, can be specified multiple times
(default is all enabled).
-e CACHEDIR, --cachedir CACHEDIR
Directory in which to store metadata.
-t, --tempcache
Use a temp dir for storing/accessing yum-cache.
-d, --delete
Delete local packages no longer present in repository.
-p DESTDIR, --download_path=DESTDIR
Path to download packages to: defaults to current
directory.
--norepopath
Don't add the reponame to the download path. Can only be
used when syncing a single repository (default is to add
the reponame).
-g, --gpgcheck
Remove packages that fail GPG signature checking after
downloading. exit status is '1' if at least one package
was removed.
-u, --urls
Just list urls of what would be downloaded, don't
download.
-l, --plugins
Enable yum plugin support.
-m, --downloadcomps
Also download comps.xml.
--download-metadata
Download all the non-default metadata
-n, --newest-only
Download only newest packages per-repo.
-q, --quiet
Output as little information as possible.
--allow-path-traversal
Allow packages stored outside their repo directory to be
synced. These are packages that are referenced in
metadata by using absolute paths or up-level ".." symbols,
and are normally skipped by reposync for security reasons.
CAUTION: Using this option has potential security
implications since, by providing malicious repodata, an
attacker could make reposync write to arbitrary locations
on the file system that are accessible by the user running
Local Repository를 바라보도록 설정 하는 방법
cd /etc/yum.repos.d
mkdir backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup
vi local-repos.repo
...
[local-base]
name=CentOS Base
baseurl=http://172.10.0.39/base/
gpgcheck=0
enabled=1
[local-centosplus]
name=CentOS Plus
baseurl=http://172.10.0.39/centosplus/
gpgcheck=0
enabled=1
[local-docker-ce]
name=docker-ce
baseurl=http://172.10.0.39/docker-ce/
gpgcheck=0
enabled=1
[local-epel]
name=epel
baseurl=http://172.10.0.39/epel/
gpgcheck=0
enabled=1
[local-extras]
name=CentOS extras
baseurl=http://172.10.0.39/extras/
gpgcheck=0
enabled=1
[local-ius]
name=ius
baseurl=http://172.10.0.39/ius/
gpgcheck=0
enabled=1
[local-kubernetes]
name=kubernetes
baseurl=http://172.10.0.39/kubernetes/
gpgcheck=0
enabled=1
[local-salt-latest]
name=salt-latest
baseurl=http://172.10.0.39/salt-latest/
gpgcheck=0
enabled=1
[local-updates]
name=updates
baseurl=http://172.10.0.39/updates/gpg
check=0
enabled=1
...
yum clean all
yum repolist all
반응형
'Computing' 카테고리의 다른 글
Install nginx on Centos 7 (0) | 2021.04.28 |
---|---|
CentOS 7 파티션 및 마운트 (0) | 2018.09.07 |