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/
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,904评论 18 139
  • feisky云计算、虚拟化与Linux技术笔记posts - 1014, comments - 298, trac...
    不排版阅读 3,908评论 0 5
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,947评论 6 342
  • 一、Python简介和环境搭建以及pip的安装 4课时实验课主要内容 【Python简介】: Python 是一个...
    _小老虎_阅读 5,808评论 0 10
  • 源于生活,悟于生活!!!时间匆匆,市场所剩的也就那凛冽寒风,没啥事就提笔随抄随写!虽是无聊,但细节点,会发现原来生...
    逗比不可思议阅读 315评论 0 3