Ubuntu offline installation of gcc, g++, make and other dependent packages

1. Offline installation background

Because the server at the project site cannot connect to the Internet and only has an intranet environment, but it needs to be installed redis, nginxso you need to install gcc, g++, makeand other dependent packages.

2. How to obtain dependency packages

You need to prepare a computer that can connect to the Internet (for example, a virtual machine on a personal computer installs the same system as the server) to download dependency packages. Then copy the dependency packages downloaded through the Internet to the server in the intranet environment and install the dependency packages.

3. Download dependency packages

# 更新依赖源
 apt-get update
# 把缓存文件夹里的deb包清理掉
 apt-get clean
# 下载 build-essential包,因为build-essential包中有gcc,g++,make等依赖包。
# 下面命令是只下载不安装。
 apt-get install -d build-essential
# 进入缓存文件夹查询已下载的deb包。
 cd /var/cache/apt/archives

4. Copy dependent packages

Copy all the downloaded dependency packages and copy them to the project site server.

5. Install dependency packages

 dpkg -i   *.deb

6. Verify whether gcc is installed successfully

gcc --version

7. Installation completed

Guess you like

Origin blog.csdn.net/weixin_38090079/article/details/131846961