配置阿里云上的服务器

本文记录了在阿里云服务器上配置自己训练环境的过程。

安装Miniconda

wget https://repo.continuum.io/miniconda/Miniconda3-4.6.14-Linux-x86_64.sh

sh Miniconda3-4.6.14-Linux-x86_64.sh
一路ENTERyes

source ~/.bashrc

更新

1
2
3
conda update conda
conda update --all
apt-get update

安装Git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
apt-get install git
mkdir ~/keavnn
cd ~/keavnn/
git clone https://github.com/StepNeverStop/RLt.git
conda create -n tf2 python=3.6
conda activate tf2
conda install -y docopt numpy pillow yaml pyyaml pandas openpyxl

apt-get install apt-file
apt-file update
apt-file search libSM.so.6
apt-get install libsm6
apt-file search libXrender.so.1
apt-get install libxrender1

pip install protobuf grpcio grpcio-tools tensorflow tensorflow_probability

安装MuJoCo

1
2
3
4
5
6
7
8
mkdir ~/.mujoco
cd .mujoco/
wget url https://www.roboti.us/download/mujoco200_linux.zip
apt-get install zip
unzip mujoco200_linux.zip
wget url https://www.roboti.us/getid/getid_linux
chmod +x getid_linux
./getid_linux

接着把获取到的计算机ID用于注册30天免费的Mujoco引擎https://www.roboti.us/license.html

把邮箱里的mjkey.txt通过ssh连接或者sftp软件File Zilla放置云服务器上

放在~/.mujoco~/.mujoco/mujoco200_linux/bin文件夹下

1
2
3
mv ~/.mujoco/mujoco200_linux ~/.mujoco/mujoco200
apt-get install nano
nano ~/.bashrc

在尾部添加export LD_LIBRARY_PATH=$HOME/.mujoco/mujoco200/binexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco200/bin然后保存退出

1
2
3
source ~/.bashrc
apt install python3-pip
pip install --upgrade pip

注意:在配置完Git之后:

1
2
3
4
5
6
7
8
9
10
11
conda activate tf2
apt install libosmesa6-dev
apt-get install python3 python-dev python3-dev \
build-essential libssl-dev libffi-dev \
libxml2-dev libxslt1-dev zlib1g-dev \
python-pip libgl1-mesa-dev patchelf libglfw3 libglfw3-dev
pip install fasteners
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U 'mujoco-py<2.1,>=2.0'

cd ~/keavnn/RLt/gym
pip install -e '.[all]'
1
2
3
Successfully built mujoco-py
Installing collected packages: mujoco-py
Successfully installed mujoco-py-2.0.2.9

测试一下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ python3
import mujoco_py
import os
mj_path, _ = mujoco_py.utils.discover_mujoco()
xml_path = os.path.join(mj_path, 'model', 'humanoid.xml')
model = mujoco_py.load_model_from_path(xml_path)
sim = mujoco_py.MjSim(model)

print(sim.data.qpos)
# [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]

sim.step()
print(sim.data.qpos)
# [-2.09531783e-19 2.72130735e-05 6.14480786e-22 -3.45474715e-06
# 7.42993721e-06 -1.40711141e-04 -3.04253586e-04 -2.07559344e-04
# 8.50646247e-05 -3.45474715e-06 7.42993721e-06 -1.40711141e-04
# -3.04253586e-04 -2.07559344e-04 -8.50646247e-05 1.11317030e-04
# -7.03465386e-05 -2.22862221e-05 -1.11317030e-04 7.03465386e-05
# -2.22862221e-05]
-------------本文结束感谢您的阅读-------------

本文标题:配置阿里云上的服务器

文章作者:Keavnn

发布时间:2020年01月13日 - 09:01

最后更新:2020年01月17日 - 02:01

原始链接:http://StepNeverStop.github.io/config-alios.html

许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 转载请保留原文链接及作者。

如果您获得了帮助,也可以资助一下小的啦~
0%