这里主要做记录 有的数据太老了 尤其是mongodb 安装时候 网上好多源都是错的
# Ubuntu 配置
## 配置数据源
操作系统为16.04服务器版
---
- 安装ssh 服务供外网访问
1. sudo apt-get install openssh-server
1. 检查ssh服务开启状态
1. ps -s | grep ssh
1. 通过以下命令启动ssh服务
1. service ssh start
1. /etc/init.d/ssh start
---
- sudo vi /etc/apt/sources.list
- 源地址为:
# 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
# nodejs 安装
更新ubuntu软件源
sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
安装nodejs
sudo apt-get install nodejs
sudo apt install nodejs-legacy
sudo apt install npm
更新npm的包镜像源,方便快速下载
sudo npm config set registry https://registry.npm.taobao.org
sudo npm config list
全局安装n管理器(用于管理nodejs版本)
sudo npm install n -g
安装最新的nodejs(stable版本)
sudo n stable
sudo node -v
如果该方法不行 可以是用另外一种方式
先安装低版本的nodejs npm 通过 npm 升级到最新版本nodejs
具体方法如下
1、先在系统上安装好nodejs和npm
sudo apt-get install nodejs-legacy
sudo apt-get install npm
2、升级npm为最新版本
sudo npm install npm@latest -g
3、安装用于安装nodejs的模块n
sudo npm install -g n
4、通过n模块安装指定的nodejs
sudo n latest
sudo n stable
sudo n lts
5、查看版本
sudo node -v
sudo npm -v
# redis 安装
安装redis
apt-get install redis-server
检查Redis服务器系统进程
ps -aux|grep redis
通过启动命令检查Redis服务器状态
netstat -nlt|grep 6379
通过启动命令检查Redis服务器状态
/etc/init.d/redis-server status
# mysql 安装
检查是否安装mysql
在终端里面输入 sudo netstat -tap | grep mysql
安装mysql
sudo apt-get install mysql-server mysql-client
测试安装是否成功:
在终端输入 sudo netstat -tap | grep mysql
# mongodb安装
阿里云安装
# 1. 导入MongoDB public GPG Key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
# 2. 添加软件源
echo "deb [ arch=amd64,arm64 ] http://mirrors.aliyun.com/mongodb/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
# 3. 更新本地软件包
sudo apt-get update
# 4. 安装MongoDB
sudo apt-get install -y mongodb-org
根据教程,本地Ubuntu 16.04系统安装的是mongodb3.6,安装的时候提示如下,会安装下面相关几个软件包:
Get:1 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6/multiverse amd64 mongodb-org-shell amd64 3.6.0 [8,477 kB]
Get:2 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6/multiverse amd64 mongodb-org-server amd64 3.6.0 [14.9 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6/multiverse amd64 mongodb-org-mongos amd64 3.6.0 [8,468 kB]
Get:4 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6/multiverse amd64 mongodb-org-tools amd64 3.6.0 [34.9 MB]
Get:5 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6/multiverse amd64 mongodb-org amd64 3.6.0 [3,524 B]
# 查看版本
$ mongod --version
db version v3.6.0
git version: a57d8e71e6998a2d0afde7edc11bd23e5661c915
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64
数据库操作:
$ mongo # 进入shell
MongoDB shell version v3.6.0
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.0
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> show dbs; # 查看数据库列表
admin 0.000GB
config 0.000GB
local 0.000GB
>
ubuntu 更新错误 update 修复
sudo rm /var/lib/dpkg/lock
sudo apt clean
sudo rm /var/lib/apt/updates/*
sudo apt update
# elasticsearch 安装配置