标签:pipe 技术 name backup port war .gz nload pack
docker run –ti -p 80:80 --restart=always -d --name container_name centos
# 让docker 容器开机自动启动:
docker update --restart=always container_name
# 进入容器:
sudo docker exec -it container_name /bin/bash
#### 2、安装python
# (1)、安装python3依赖
sudo yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
# (2)、下载python3.3.6
sudo wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
# (3)、解包
sudo tar -zxf Python-3.6.6.tgz
# (4)、编译安装python
sudo yum install gcc gcc-c++ -y
sudo ./configure --prefix=/usr/local/python3
sudo make
make altinstall
ls /usr/local/python3/bin # 可以看到python3.6都已安装好。
# (5)、更改python链接
cd/usr/bin
sudo mv python python.backup
sudo ln -s /usr/local/python3/bin/python3.6 /usr/bin/python
sudo ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3
# (6)、更改yum脚本配置:
ls yum*
然后修改罗列出来的文件,将所有的python改为python2:
# 比如,进入上图的yum
sudo vim yum
sudo vim /usr/libexec/urlgrabber-ext-down
sudo vim /usr/libexec/urlgrabber-ext-down
# 将/usr/bin/python改为/usr/bin/python2。
python3.6.6安装完成!
设置pip
# 设置pip
sudo ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip
通过pip安装pipenv
sudo pip install pipenv
# pipenv安装完成后,指定workon_on位置
sudo vim ~/.bashrc
# 加入以下内容
export WORKON_HOME=$HOME/brad/envs
# 如果出现bash: pipenv: command not found
sudo ln -sv /usr/local/python3/bin/pipenv /usr/bin/pipenv
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install gcc perl-ExtUtils-MakeMaker
sudo yum install perl-ExtUtils-MakeMaker package
cd /tools/
sudo wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz
sudo tar xzf git-2.7.3.tar.gz
cd git-2.7.3
sudo make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
git –version
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
创建SSH Key。在用户主目录/home/brad下,看看有没有.ssh目录,如果有,再看看这个目录下有没有
id_rsa
和id_rsa.pub
这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:
ssh-keygen -t rsa -C "youremail@example.com"
docker pull mysql:8.0
(1)、为了安全性,我们应该将数据和配置放到宿主机中,首先执行下面的命令创建data目录和config目录
mkdir mysqltest
cd mysqltest
mkdir data
mkdir config
(2)、my.cnf配置文件内容如下
[mysqld]
user=mysql
character-set-server=utf8
default_authentication_plugin=mysql_native_password
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
(3)、执行下面命令创建容器
docker run -d -p 3306:3306 --restart always --privileged=true -e MYSQL_ROOT_PASSWORD="123456" --name brad_mysql -v=/home/mysql_data/data:/var/lib/mysql mysql:8.0 --character-set-server=utf8 --collation-server=utf8_general_ci --default-authentication-plugin=mysql_native_password
环境变量说明:
-e MYSQL_USER=”username”:添加用户username
-e MYSQL_PASSWORD=”pwd123”:设置usename的密码pwd123
-e MYSQL_ROOT_PASSWORD=”123456”:设置root的密码123456
镜像参数说明:
–character-set-server=utf8:设置字符集为utf8
–collation-server=utf8_general_ci:设置字符比较规则为utf8_general_ci
参数说明:
–restart always:开机启动 –privileged=true:提升容器内权限 -v=/mysqltest/config/my.cnf:/etc/my.cnf:映射配置文件 -v=/mysqltest/data:/var/lib/mysql:映射数据目录
# 1、下载nginx
sudo wget http://nginx.org/download/nginx-1.12.2.tar.gz](http://nginx.org/download/nginx-1.12.2.tar.gz
# 2、安装依赖:
yum –y install gcc gcc-c++ openssl-devel pcre-devel httpd-tools
#3、解包:
tar -zxf nginx-1.12.2.tar.gz
# 4、 创建nginx用户:
Useradd nginx
cd nginx-1.12.2
#5、执行编译
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx
# 6、添加软链接:
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
启动:nginx:
参看端口:netstat –anptu | grep nginx
如果没有netstat命令: yum install net-tools -y
标签:pipe 技术 name backup port war .gz nload pack
原文地址:https://www.cnblogs.com/xz1024/p/9750594.html