新的Ubuntu,fabric从0到完成(一)

一、基本环境配置

1.备份原有的源文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2.删除源文件(如果无法删除,需要赋予权限 chmod 777 /etc/apt/sources.list )

rm /etc/apt/sources

3.创建源文件并将一下部分写入

sudo vim /etc/apt/sources.list
或者
sudo gedit /etc/apt/sources.list

4.复制如下地址到文件内容(本处使用的是阿里源)

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

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

5.紧接着从新跟新执行命令

sudo apt update

二、fabric环境搭建

在root先安装,否则会出错误!!!!1
1.安装Git

sudo apt install git

2.安装docker和docker-compose

sudo apt-get update
sudo apt install docker.io
sudo apt install docker-compose
chmod +x /usr/share/doc/docker-compose#允许其他用户操作docker-compose
sudo systemctl enable docker #开机启动docker服务

3.安装curl和vim

sudo apt-get install curl
sudo apt-get install vim

4.安装go

curl -O https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz
tar -zxvf go1.17.5.linux-amd64.tar.gz  -C /usr/local/

配置环境
在文件末尾加入如下代码

sudo vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

使用 source 命令,使刚刚添加的配置信息生效

source /etc/profile

使用 go version 命令验证是否安装成功

go version

配置go,使其在全局和局部环境下都可用,链接
5.安装nodejs

sudo apt-get install nodejs
node -v
sudo apt install npm
#更换淘宝镜像源
npm config set registry https://registry.npm.taobao.org
#查看配置是否生效
sudo npm config list
#安装更新版本的工具N
sudo npm install n -g
#跟新node版本
sudo n stable
node -v

6.安装make g++ libltdl-dev 库

 sudo apt install make
 sudo apt install g++
 sudo apt-get install libltdl-dev

三、出现问题

问题1.安装curl报错

下列软件包有未满足的依赖关系: curl : 依赖: libcurl3-gnutls (= 7.47.0-1ubuntu2.19) 但是
7.68.0-1ubuntu2.1 正要被安装 E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

解决,那就先安装libcurl3-gnutls,然后安装curl

apt-get purge libcurl3-gnutls
apt-get install curl

问题2.安装docker-compose出错

root@ubuntu:/home/dou/Desktop# apt install docker-compose
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:

下列软件包有未满足的依赖关系: docker-compose : 依赖: python-cached-property 但是它将不会被安装
依赖: python-docker (>= 1.9.0) 但是它将不会被安装
依赖: python-dockerpty (>= 0.4.1) 但是它将不会被安装
依赖: python-docopt 但是它将不会被安装
依赖: python-enum34 但是它将不会被安装
依赖: python-jsonschema 但是它将不会被安装
依赖: python-requests (>= 2.6.1) 但是它将不会被安装
依赖: python-six (>= 1.3.0) 但是它将不会被安装
依赖: python-texttable 但是它将不会被安装
依赖: python-websocket 但是它将不会被安装
依赖: python-yaml 但是它将不会被安装
依赖: python:any (< 2.8)
依赖: python:any (>= 2.7.5-5~) E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

解决办法:就是有点慢,多试几次

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

猜你喜欢

转载自blog.csdn.net/weixin_42375493/article/details/125582745