Ubuntu常用命令,环境配置
Ubuntu操作系统使用 gcc cmake make 等套件编译软件;Ubuntu操作系统拥有较为完整的软件依赖仓库;本文介绍常见镜像依赖处理方法。
1 2 3 4 5 6 7 8 # 阿里云镜像 sudo sed -i "s@http://.*archive.ubuntu.com@http://mirrors.aliyun.com/ubuntu@g" /etc/apt/sources.list sudo sed -i "s@http://.*security.ubuntu.com@http://mirrors.aliyun.com/ubuntu@g" /etc/apt/sources.list apt update # 华为云镜像 sudo sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list sudo sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list apt update
1 2 3 4 # ubuntu 使用gcc组件和cmake实现本地编译软件使用 apt -y --no-install-recommends install ca-certificates build-essential cmake # 其中 build-essential 是 gcc变异工具组, cmake是单独组建不与 build-essential 打包,ca-certificates是ssl证书工具,默认自带安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 FROM dockerpull.com/ubuntu:20.04 LABEL authors="leapord" RUN sed -i 's/archive.ubuntu.com/mirrors.huaweicloud.com/g' /etc/apt/sources.list RUN sed -i 's/security.ubuntu.com/mirrors.huaweicloud.com/g' /etc/apt/sources.list RUN sed -i 's/ports.ubuntu.com/mirrors.huaweicloud.com/g' /etc/apt/sources.list RUN export DEBIAN_FRONTEND=noninteractive &&\ apt-get update && \ apt-get install -y --no-install-recommends ca-certificates ffmpeg curl build-essential cmake libpcre3 libpcre3-dev libssl-dev zlib1g zlib1g-dev && \ apt-get autoremove -y && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/*dic && \ mkdir -p /opt/ivm/config && mkdir -p /opt/ivm/heapdump && mkdir -p /opt/ivm/logs && mkdir -p /opt/ivm/snap && mkdir /opt/jdk1.8 && mkdir -p /opt/ivm/static && mkdir -p /opt/nginx/ssl/ COPY tengine-3.1.0.tar.gz /opt/nginx/ WORKDIR /opt/nginx/ RUN tar -xvf tengine-3.1.0.tar.gz && cd tengine-3.1.0 && ./configure --prefix=/opt/nginx && make && make install && rm -rf /opt/nginx/tengine-3.1.0* CMD ["/opt/nginx/sbin/nginx" ]
1 2 3 4 5 6 7 8 9 10 11 12 13 # 安装 vim,curl,zlib等依赖库 apt -y install curl libpcre3 libpcre3-dev libssl-dev zlib1g zlib1g-dev # 配置免密提权,生产环境不建议使用免密提权 visudo # 添加对应的账号信息 username ALL=(ALL:ALL) NOPASSWD:ALL # 配置ssh远程登录 apt -y install openssh-server vim /etc/ssh/sshd_config # 放开以下操作 PasswordAuthentication yes PermitRootLogin yes