ubunt更新镜像源脚本

#!/bin/bash

SOURC='deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse\ndeb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse\ndeb https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse\ndeb https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse'

echo -e $SOURC > /etc/apt/sources.list

sudo apt-get update

sudo apt-get upgrade #安装一些常用软件

sudo apt install vim

sudo apt install openssh-server

sudo apt install openssh-client

sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/ssh_config

sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config #修改SSH配置文件

 

 在系统中创建一个脚本,比如我创建了一个SystemInit.sh脚本文件

touch SystemInit.sh

更改这个脚本的权限

sudo chmod 777 SystemInit.sh

将最上面的文本拷贝到该脚本

最后执行脚本

sudo ./SystemInit.sh

在更新镜像的时候会需要你输入用户密码和多次输入yes

可以继续编辑脚本添加你常用的软件安装

posted @ 2020-09-21 16:39  isyf  阅读(157)  评论(0编辑  收藏  举报