Ubuntu折腾记录

SSH服务

1、安装

sudo apt-get install openssh-server

2、启动

sudo service ssh start

3、查询状态(可选)

sudo service ssh status 
或者
sudo ps -e | grep ssh

4、配置

sudo vim /etc/ssh/sshd_config

这里可以修改端口号,默认22端口。
在页面最后添加以下配置,用于防止Putty无法连接的BUG。

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1

如果没有添加上面配置,Putty连接时会提示expected key exchange group packet from server错误,若不使用Putty这里可以不进行配置。

最后再更新一下配置

systemctl restart sshd

5、关闭防火墙
如果开启了ufw建议进行关闭

sudo ufw disable

6、配件静态IP
首先找到外网的网卡名称,执行ifconfig -a命令返回如下:

eth0      Link encap:以太网  硬件地址 00:11:32:5f:94:4f
          inet 地址:10.0.0.8  广播:10.0.0.255  掩码:255.255.255.0
          inet6 地址: fe80::4829:79b3:b677:c1c4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:60887 错误:0 丢弃:171 过载:0 帧数:0
          发送数据包:6114 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000
          接收字节:15933461 (15.9 MB)  发送字节:721431 (721.4 KB)

lo        Link encap:本地环回
          inet 地址:127.0.0.1  掩码:255.0.0.0
          inet6 地址: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  跃点数:1
          接收数据包:10107 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:10107 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000
          接收字节:1313818 (1.3 MB)  发送字节:1313818 (1.3 MB)

例如以上eth0为外网网卡名称

修改网络配置文件sudo vi /etc/network/interfaces

auto eth0
iface eth0 inet static
address 10.0.0.8
netmask 255.255.255.0
gateway 10.0.0.1
dns-nameserver 10.0.0.1

重启网络服务

sudo /etc/init.d/networking restart

修改更新源

1、打开更新源文件

sudo vi /etc/apt/sources.list

2、将以下内容进行替换

# deb cdrom:[Ubuntu 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

3、最后执行一下更新

sudo apt-get update
sudo apt-get dist-upgrade

安装常用软件

1、删除亚马逊链接

sudo apt-get remove unity-webapps-common

2、安装Vim

sudo apt-get install vim

PuTTY可选配置:


将PuTTY中的Vim小键盘改为数字键盘功能

3、安装sysv-rc-conf

sudo apt-get install sysv-rc-conf

启动sysv-rc-conf

sudo sysv-rc-conf

4、安装Python3-pip及常用包

安装pip3

sudo apt-get install python3-pip

更换pip3下载源

mkdir ~/.pip 
vim ~/.pip/pip.conf

添加以下内容:

[global]
timeout = 6000
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = pypi.tuna.tsinghua.edu.cn

安装pip3常用包

pip3 install beautifulsoup4
pip3 install requests

5、安装NFS客户端

sudo apt-get install nfs-common

加载远程目录

sudo mount 远程IP:远程目录 本地目录
sudo mount 10.0.0.7:/volume2/file /home/chishin/file

本地目录映射

ln -s 源目录 目的目录
ln -s /home/chishin/file/Python /home/chishin/
sudo ln -s /home/chishin/file/wwwroot/ /www/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值