王海庆的云笔记

CentOS7安装openlava-web(未成功)


sqlite3、openlava-python、openlava-web都会报错


关闭防火墙

systemctl stop firewalld
systemctl disable firewalld
sed -i -e  's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0


换成阿里云的源

rm -rf /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

yum clean all
yum makecache fast -y


常用命令

# 切换用户
su openlava

# 提交任务到openlava
bsub sleep 100

# 查看任务状态和基本信息
bjobs

# 查看队列状态和基本信息
bqueues

# 查看机器状态及基本信息
bhosts

# 查看机器资源状态
lshosts

# 查看机器负载状态
lsload


安装依赖包

yum -y install python-django python-pip git python-devel gcc lighttpd lighttpd-fastcgi

pip install flup cython -i https://mirrors.tencent.com/pypi/simple/
pip install Django==1.8 -i https://mirrors.tencent.com/pypi/simple/


升级sqlite3的版本,SQLITE 3.9.0 OR LATER IS REQUIRED (FOUND 3.7.17)

# 创建目录
mkdir -p /usr/local/sqlite && cd /usr/local/sqlite

# 下载(这里上官网https://www.sqlite.org自己找一下)
wget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz

# 解压
tar -zxvf sqlite-autoconf-3350500.tar.gz

# 编译安装
cd sqlite-autoconf-3350500
./configure --prefix=/usr/local/sqlite
make && make install

# 修改软连接
mv /usr/bin/sqlite3 /usr/bin/sqlite3.bak
ln -s /usr/local/sqlite/bin/sqlite3 /usr/bin/sqlite3

# 配置环境变量并生效
cat >>  /etc/profile << EOF
export LD_LIBRARY_PATH="/usr/local/sqlite/lib"
EOF
source /etc/profile

# 检查版本
sqlite3 --version


安装openlava-python

rm -rf /opt/openlava-python

# git clone https://github.com/irvined1982/openlava-python.git /opt/openlava-python
git clone https://hub.fastgit.org/irvined1982/openlava-python.git /opt/openlava-python
cd /opt/openlava-python/openlava/
python setup.py install

报错,可参考https://github.com/irvined1982/openlava-python/issues/2


安装openlava-web

rm -rf /opt/openlava-web

git clone https://github.com/irvined1982/openlava-web.git /opt/openlava-web
# git clone https://hub.fastgit.org/irvined1982/openlava-web.git /opt/openlava-web
cd /opt/openlava-web
git submodule update --init --recursive
python setup.py install


创建Django项目并配置


在/opt目录下创建Django项目openlava_webui

cd /opt/
django-admin startproject openlava_webui
cp -r /opt/openlava-web/openlavaweb/ /opt/openlava_webui/


编辑/opt/openlava_webui/openlava_webui/urls.py文件及openlavaweb.urls文件:

vi /opt/openlava_webui/openlava_webui/urls.py  

    url(r'^', include('openlavaweb.urls')),


编辑/opt/openlava_webui/openlava_webui/settings.py文件来包含openlavaweb:

INSTALLED_APPS = (
	......
    'openlavaweb',
)


运行

python /opt/openlava_webui/manage.py runserver 0.0.0.0:8000


访问

http://172.18.0.115:8000


参考

https://qiming.info/Openlava安装教程/
https://github.com/irvined1982/openlava-python/issues/2




文章最后更新时间: 2022-01-04 22:34:30