Use different Python 3.x with virtualenv

Why?

for each project, it may have different dependencies, if we upgrade global, some projects may not work.

  • each virtual environments may has a different python version, different python index package (pip)

Prerequisite

install virtualenv with pip: pip install virtualenv

Create a virtualenv, assume all environments stored in ~/Environments

cd ~/Environments
virtualenv --python=/usr/local/bin/python3.8 v38
virtualenv --python=/usr/local/bin/python2.7 v2

Activate a virtual environment: source ~/Environments/v38/bin/activate
Example:

[[email protected] prometheus-anomaly-detector]$ source ~/Environments/v38/bin/activate
(v38) [[email protected] prometheus-anomaly-detector]$ which python
# /u01/userhome/oracle/Environments/v38/bin/python
(v38) [[email protected] prometheus-anomaly-detector]$ which pip
# /u01/userhome/oracle/Environments/v38/bin/pip
(v38) [[email protected] prometheus-anomaly-detector]$ pip --version
# pip 20.2.4 from /u01/userhome/oracle/Environments/v38/lib/python3.8/site-packages/pip (python 3.8)
(v38) [[email protected] prometheus-anomaly-detector]$ python --version
# Python 3.8.3

Deactivate a virtual environment with deactivate

(v38) [[email protected] prometheus-anomaly-detector]$ deactivate 
[[email protected] prometheus-anomaly-detector]$ 

Install cyberpanel on Ubuntu 20.04

Basically, we can install cyberpanel just by executing a command as root:

sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)

After that, we can log in by https://<ServerIP>:8090 with username admin and a chosen password


Q: How do I remove port 8090, eg I want to use panel.example.com instead of ServerIP:8090.
A: Follow the guideline here:

  1. create a website for the domain. Eg: panel.example.com
    • configure an A record for panel of example.com to point to <ServerIP>
    • create a new website with domain panel.example.com
      • Select issue SSL option
  2. Update lsws service:
    • append to file /usr/local/lsws/conf/httpd_config.confextprocessor cyberpanel { type proxy address https://panel.example.com:8090 maxConns 100 pcKeepAliveTimeout 60 initTimeout 60 retryTimeout 0 respBuffer 0 }
    restart service: systemctl restart lsws.service
  3. Update rewrite rule:
REWRITERULE ^(.*)$ HTTP://cyberpanel/$1 [P]

FAQ:

  • Get the detault admin password of rainloop with command:
cat /usr/local/CyberCP/public/rainloop.php
  • Change/Reset the admin password of CyberPanel
[email protected]:~# adminPass '[email protected]!'
Admin password successfully changed!