1、首先关闭防护墙或者设置规则通过且关闭selinux
2、nginx-1.14.2版本(编译安装)-自定义安装路径
3、开启nginx目录浏览
以上步骤请参考前文:https://www.cnblogs.com/omgasw/p/10194698.html
4、调整分区大小
把/dev/centos/home下的50G变为8G
1.增加
1.1去掉挂载
df –Th #查看分区信息
umount /home
1.2减小home,
lvreduce -L 8G /dev/centos/home 或 -42G
1.3扩容/dev/centos/root
lvextend -L 42G /dev/centos/root
xfs_growfs /dev/centos/root
2.减小
xfs是不支持减少的,但无法使用resize2fs,会报错:Couldn't find valid filesystem superblock。意思就是减少后的逻辑分区需要通过mkfs.xfs命令重新格式化一下
5、使用Alien将RPM转换成DEB
1.安装Alien及其依赖包
要安装alien到CentOS/RHEL 7中,你需要启用EPEL和Nux Dextop仓库
yum install epel-release -y
启用Nux Dextop仓库的包的当前最新版本是0.5(2015年8月10日发布),在安装之前你可以查看http://li.nux.ro/download/nux/dextop/el7/x86_64/上是否有更新的版本
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm yum update && yum install alien -y
2.将deb转换成rpm包
wget(例:dateutils_0.3.1-1.1_amd64.deb)
alien dateutils_0.3.1-1.1_amd64.deb
在Linux中将deb转换成rpm
重要:(请注意alien是怎样来增加目标包的次版本号的,如果你想要无视该行为,请添加-keep-version标识)
6、创重新构建RPM包
如果我们尝试马上安装该包,我们将碰到些许问题:
rpm -ivh dateutils-0.3.1-2.1.x86_64.rpm
要解决该问题,我们需要启用epel-testing仓库,然后安装rpmbuild工具来编辑该包的配置以重建包:
yum --enablerepo=epel-testing install rpmrebuild -y
然后运行
rpmrebuild -pe dateutils-0.3.1-2.1.x86_64.rpm
它会打开你的默认文本编辑器,请转到%files并删除涉及到错误信息中提到的目录的行,然后保存文件并退出:
退出该文件后,将提示你继续去重构,如果你选择“Y”,该文件会重构到指定的目录(与当前工作目录不同):
7、apt-mirror配置
1.安装apt-mirror
rpm –ivh apt-mirror_0.5.4-2.noarch.rpm
2.修改apt-mirror配置文件
在修改配置文件之前,我们首先要确定自己系统的版本,sudo lsb_release -a
#sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04 LTS
Release: 16.04
Codename: xenial
Codename代号的意思,16.04代号xenial,所以我们接下来的配置文件跟xenial有关,当然14.04代号是trusty,一样的操作
打开清华大学开源镜像
进入dists目录,在目录下找到跟系统代号相关问文件夹,一般是5个,将下面规则文本复制出来,把加粗部分替换成相应的5个文件目录名。进入这5个目录,里面有4个跟源有关的目录(by-hash除外),目录名与下面斜体部分比较,如果不一样请修改
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
然后
vim /etc/apt/mirror.list
参考以下配置文件:
清空原有的配置文件,修改以下配置文件相应代号部分即可,如果想添加多个版本的源,可以依次在下面增加相应的规则(就是增加对应代号的源地址)
############# config ##################
# 以下注释的内容都是默认配置,如果需要自定义,取消注释修改即可
set base_path /yryun/ubuntu
# 镜像文件下载地址
# set mirror_path $base_path/mirror
# 临时索引下载文件目录,也就是存放软件仓库的dists目录下的文件(默认即可)
# set skel_path $base_path/skel
# 配置日志(默认即可)
# set var_path $base_path/var
# clean脚本位置
# set cleanscript $var_path/clean.sh
# 架构配置,i386/amd64,默认的话会下载跟本机相同的架构的源
set defaultarch amd64
# set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
#如果报/bin/sh: 0: can't open /media/newsmy/ubuntu1204mirror/var/postmirror.sh,把set run_postmirror 0即可
# 下载线程数
set nthreads 20
set _tilde 0
############# end config ##############
# 清华大学开源 # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 # ubuntu 18.04 LTS deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse # ubuntu 16.04 LTS deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse # ubuntu 14.04 LTS deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse # debian 9 deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free clean http://mirrors.tuna.tsinghua.edu.cn/ubuntu clean http://mirrors.tuna.tsinghua.edu.cn/debian
3.指向镜像路径
ln –s /yryun/ubuntu/mirror/mirrors.tuna.tsinghua.edu.cn/ubuntu/ /usr/local/nginx/html/pack/ubuntu ln –s /yryun/ubuntu/mirror/mirrors.tuna.tsinghua.edu.cn/debian/ /usr/local/nginx/html/pack/debian
4.开始同步
apt-mirror
等待很长时间(该镜像差不多100G左右,具体时间看网络环境)
注意:当apt-mirror 被意外中断时,只需要重新运行即可,apt-mirror支持断点续存;另外,意外关闭,需要在/var/spool/apt-mirror/var目录下面删除 apt-mirror.lock文件【 sudo rm apt-mirror.lock 】,之后执行apt-mirror重新启动
5.创建自动同步
vim /etc/crontab
0 5 * * 2 root /usr/bin/apt-mirror >/dev/null 2>&1
8、客户端配置
1.编辑/etc/apt/source.list,选择相应的版本
# ubuntu 18.04 LTS deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ bionic main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ bionic-security main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ bionic-updates main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ bionic-backports main restricted universe multiverse
# ubuntu 16.04 LTS deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ xenial main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ xenial-security main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ xenial-updates main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ xenial-backports main restricted universe multiverse
# ubuntu 14.04 LTS deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ trusty main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ trusty-security main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ trusty-updates main restricted universe multiverse deb [arch=amd64] http://mirrors.yryun.com/ubuntu/ trusty-backports main restricted universe multiverse
# debian 9 deb [arch=amd64] http://mirrors.yryun.com/debian/ stretch main contrib non-free deb [arch=amd64] http://mirrors.yryun.com/debian/ stretch-updates main contrib non-free deb [arch=amd64] http://mirrors.yryun.com/debian/ stretch-backports main contrib non-free
2.更新apt-get源
sudo apt update