Centos7 production extended local source

Time:2020-9-22

Introduce the following mainstream Linux operating systems:

Premise: install the virtual machine of the corresponding system version (if there is a mine at home, you can use the physical machine)

Centos 7:

1. Check the virtual machine system version and keep it consistent with the offline environment system version

cat /etc/centos-release

uname -a

2. Configure the networking Yum source. The system will be installed with the basic Yum source by default

cd /etc/yum.repos.d/

ls -rlt

3. There are only basic libraries in the default Yum source. Add repo files according to your own needs, such as installing PostgreSQL source

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

4. Check the yum configuration file and find that it has been updated

cd /etc/yum.repos.d/

ls -rlt

5. Download the local RPM package with the yum command

Yum install — downloadonly — downloaddir = / XX / xxx software name

6. View the local RPM package and generate the repo folder

cd /opt/gcc && createrepo ./

7. Package the local RPM package so that a local source available in the offline environment is ready

tar -zcvf gcc.tar.gz /opt/gcc

8. Upload the local source package made in the previous step to the offline environment and make the available source

tar -zxvf gcc.tar.gz -C /XX/XXXX

mkdir -p /etc/yum.repo.d/bak

mv /etc/yum.repo.d/*.repo /etc/yum.repo.d/bak

touch /etc/yum.repo.d/local.repo

cat << EOF >> /etc/yum.repos.d/local.repo

[gcc]
name=CentOS-$releasever – gcc
baseurl=file:///XX/XXXX
gpgcheck=0
enabled=1

EOF

9. Load the local source and install the software. At this point, the construction of the local source is completed.

yum clean all

yum makecache

yum install XX