【Ubuntu 16.04.2_64】系统配置
Ubuntu 16.04.2_64系统配置
转载:http://www.cnblogs.com/yangchongxing/p/9049897.html
Ubuntu Server服务指南:https://help.ubuntu.com/16.04/serverguide/index.html
准备事项
虚拟机网络选择桥接模式、如果使用的是无线网络,则配置适配器为自己的无线网络。
网络ping -c 192.168.1.181
查看netstat -rn
重启reboot、关机shutdown -h now
1、启用root用户
$sudo passwd root
输入两次密码就OK了。
2、安装VIM
#apt-get install vim
3、安装ssh
#apt-get install ssh
启用root ssh连接
# vim /etc/ssh/sshd_config
修改如下部分,允许root登陆
# Authentication: LoginGraceTime 120 #PermitRootLogin without-password PermitRootLogin yes StrictModes yes
重新启动ssh服务
# service ssh restart
4、安装中文语言包
# apt-get install language-pack-zh-hans
5、配置静态IP
# vi /etc/network/interfaces
注释
#iface ens33 inet dhcp
追加
iface ens33 inet static
address 192.168.1.181
gateway 192.168.1.1
netmask 255.255.255.0
修改DNS
#vim /etc/resolv.conf nameserver 192.168.1.1
重启失效追加DNS
vi /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.1.1 nameserver 8.8.8.8 nameserver 8.8.4.4
Google提供的免费DNS服务器的IP地址
主 8.8.8.8 和 备 8.8.4.4
重启网络
# /etc/init.d/networking restart
6、修改源
# cp /etc/apt/sources.list /etc/apt/sources.list.bak
# vim /etc/apt/sources.list
# apt-get update
若apt-get update出现错误,则
# vim /etc/resolv.conf
追加 nameserver 8.8.8.8
阿里源
18.04.03 LTS
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
16.04 LTS
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted
#Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe
#Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
#Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
#Added by software-properties
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://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
#Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
7、关闭防火墙、启用防火墙
# ufw disable
# ufw anable
8、安装java环境
下载jdk-8u131-linux-x64.tar.gz和tomcat9.tar.gz,解压到/root目录,你也可以解压到其他路径。
配置root环境
# vim .profile
追加
export JAVA_HOME=/root/jdk1.8.0_131
export JRE_HOME=/root/jdk1.8.0_131/jre
export CLASSPATH=.:JRE_HOME/lib
export PATH=JAVA_HOME/bin:$JRE_HOME/bin
然后
# source .profile
配置所有用户环境
# vim /etc/profile 追加 export JAVA_HOME=/root/jdk1.8.0_131 export JRE_HOME=/root/jdk1.8.0_131/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin # source /etc/profile
9、安装Redis数据库
命令行安装
# apt-get install redis-server
检查Redis服务器系统进程
# ps -aux|grep redis redis 13743 0.0 0.6 41876 6660 ? Ssl 19:51 0:00 /usr/bin/redis-server *:6379 root 13802 0.0 0.0 15964 928 pts/0 S+ 19:58 0:00 grep --color=auto redis
检查Redis服务器监听端口
# netstat -nlt|grep 6379 tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
检查Redis服务器状态
# /etc/init.d/redis-server status
修改Redis服务配置
# vi /etc/redis/redis.conf
进入vim后按Esc,/requirepass 检索,检索到后n向后检索,N向前检索
设置访问密码,去掉注解
requirepass 123456
远程访问Redis服务器,注释bind
#bind 127.0.0.1
重启Redis服务器
# /etc/init.d/redis-server restart
使用客户端验证
有密码登录
# redis-cli -a 123456
无密码登录
# redis-cli
在远程的另一台Linux访问Redis服务器
# redis-cli -a 123456 -h 192.168.1.190
登陆后测试
# redis-cli -a 123456 127.0.0.1:6379> keys * #查看 1) "key2" 2) "key1" 127.0.0.1:6379> set key3 aaa # 添加 OK 127.0.0.1:6379> keys * 1) "key2" 2) "key3" 3) "key1" 127.0.0.1:6379> get key3 #获取 "aaa" 127.0.0.1:6379> del key3 #删除 (integer) 1 127.0.0.1:6379> keys * 1) "key2" 2) "key1" 127.0.0.1:6379>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端