前言
在政务网、机密服务器等不可访问外网的环境下安装环境的方法
centos服务
方法一----二进制编译
具体方法百度对应安装教程,网上很多教程
方法二----rpm包安装
- 在网上下载对应服务的rpm包,上传服务器上后通过rpm包一键安装
- 安装失败时会提醒安装失败的原因(一般是由缺少对应的插件包或插件包对应不上导致的,只用在网上下载对应插件包的rpm包,然后重复上一步)
- 循环前两步直至安装成功
缺点:由于不知道缺少那些插件包导致非常浪费时间
方法三----rpm包安装(变种)
- 本地搭建一台可以连接外网的虚拟机
- 修改虚拟机yum.conf配置文件(保存yum命令下载的rpm包)
- 在虚拟机中通过yum命令一键安装对应服务
- 找到虚拟机下yum下载的包文件
- 导出所有yum下载的rpm文件
- 上传到正式服务器上
- 安装所有上传的rpm包
说明
1、yum详解
$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum #yum下载的RPM包的缓存目录
keepcache=0 #缓存是否保存,1保存,0不保存。
debuglevel=2 #调试级别(0-10),默认为2(具体调试级别的应用,我也不了解)。
logfile=/var/log/yum.log #yum的日志文件所在的位置
exactarch=1 #在更新的时候,是否允许更新不同版本的RPM包,
#比如是否在i386上更新i686的RPM包。
obsoletes=1 #这是一个update的参数,具体请参阅yum(8),
#简单的说就是相当于upgrade,允许更新陈旧的RPM包。
gpgcheck=1 #是否检查GPG(GNU Private Guard),一种密钥方式签名。
plugins=1 #是否允许使用插件,默认是0不允许,
#但是我们一般会用yum-fastestmirror这个插件。
installonly_limit=3 #允许保留多少个内核包。
exclude=selinux* #屏蔽不想更新的RPM包,可用通配符,多个RPM包之间使用空格分离。
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE or IN separate files named file.repo
# in /etc/yum.repos.d
2、rpm安装命令
#安装命令
rpm -ivh *.rpm
#强制安装命令
rpm -ivh *.rpm --nodeps --force
ubuntu
参考centos步骤
注意事项:
- ubuntu的后缀名为deb
- ubuntu的安装方法:dpkg -I *.deb