GNU/Linux >> Tutoriels Linux >  >> Cent OS

Comment installer et configurer web2py sur CentOS 7

Web2Py est un framework Python simple mais puissant pour développer des applications Web. Dans ce tutoriel, nous allons montrer comment installer le framework Web2Py sur un VPS CentOS 7.

Tout d'abord. Une fois que vous avez le VPS, assurez-vous de le mettre à jour afin de disposer de la dernière version du logiciel.

# yum update

Créez votre répertoire d'applications. Dans cet exemple, nous travaillerons dans le répertoire /opt mais vous pouvez utiliser un répertoire de votre choix.

# mkdir /opt/web2pyapp
# git clone --recursive https://github.com/web2py/web2py.git /opt/web2pyapp

Nous aurons besoin d'une clé SSL et d'un certificat pour pouvoir accéder ultérieurement à l'interface d'administration. Pour des raisons de sécurité, il est préférable de les mettre dans un répertoire différent.

# mkdir /opt/web2pyapp_keys
# cd /opt/web2pyapp_keys
# openssl req -x509 -new -newkey rsa:4096 -days 3652 -nodes -keyout web2pyapp.key -out web2pyapp.crt

Generating a 4096 bit RSA private key
......++
.......................................................++
writing new private key to 'web2pyapp.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:US
State or Province Name (full name) []:Missouri
Locality Name (eg, city) [Default City]:St. Louis
Organization Name (eg, company) [Default Company Ltd]:Web2Py
Organizational Unit Name (eg, section) []:Web2Py
Common Name (eg, your name or your server's hostname) []:web2py.myvps.com
Email Address []:


### Set proper privileges for the ssl certificate
cd /opt
# chmod 700 web2pyapp_keys
# chmod -R 600 web2pyapp_keys/*

Si tout est fait correctement par cette étape, voici comment devrait notre mise en page dans /opt devrait ressembler.

# ls -l /opt
total 8
drwxr-xr-x 13 root root 4096 Nov 12 11:21 web2pyapp
drwx------  2 root root 4096 Nov 12 11:04 web2pyapp_keys

# ls -l /opt/web2pyapp
total 1268
-rw-r--r-- 1 root root     214 Nov 12 09:46 ABOUT
-rw-r--r-- 1 root root   12965 Nov 12 09:46 anyserver.py
drwxr-xr-x 5 root root    4096 Nov 12 10:37 applications
-rw-r--r-- 1 root root     747 Nov 12 09:46 appveyor.yml
-rw-r--r-- 1 root root   65085 Nov 12 09:46 CHANGELOG
drwxr-xr-x 2 root root    4096 Nov 12 10:01 deposit
drwxr-xr-x 2 root root    4096 Nov 12 09:46 docs
drwxr-xr-x 2 root root    4096 Nov 12 09:46 examples
drwxr-xr-x 4 root root    4096 Nov 12 09:46 extras
-rw-r--r-- 1 root root    6067 Nov 12 09:46 fabfile.py
drwxr-xr-x 5 root root    4096 Nov 12 10:37 gluon
drwxr-xr-x 2 root root    4096 Nov 12 09:46 handlers
-rw-r--r-- 1 root root   18338 Nov 12 11:21 httpserver.log
-rw-r--r-- 1 root root    5727 Nov 12 09:46 LICENSE
drwxr-xr-x 2 root root    4096 Nov 12 10:01 logs
-rw-r--r-- 1 root root    5684 Nov 12 09:46 Makefile
-rw-r--r-- 1 root root      24 Nov 12 09:46 MANIFEST.in
-rw------- 1 root root     756 Nov 12 11:10 nohup.out
-rw-r--r-- 1 root root      92 Nov 12 11:20 parameters_8000.py
-rw-r--r-- 1 root root    3896 Nov 12 09:46 README.markdown
drwxr-xr-x 2 root root    4096 Nov 12 09:46 scripts
-rw-r--r-- 1 root root    3320 Nov 12 09:46 setup.py
drwxr-xr-x 2 root root    4096 Nov 12 09:46 site-packages
-rw-r--r-- 1 root root     337 Nov 12 09:46 tox.ini
-rw-r--r-- 1 root root      52 Nov 12 09:46 VERSION
-rwxr-xr-x 1 root root     900 Nov 12 09:46 web2py.py
-rw-r--r-- 1 root root 1089202 Nov 12 10:01 welcome.w2p

# ls -l /opt/web2pyapp_keys
total 8
-rw------- 1 root root 2057 Nov 12 09:52 web2pyapp.crt
-rw------- 1 root root 3272 Nov 12 09:52 web2pyapp.key

Nous sommes prêts à démarrer notre serveur d'application Python maintenant.

# python /opt/web2pyapp/web2py.py -a 'STRONG-PASSWORD-HERE' -k /opt/web2pyapp_keys/web2pyapp.key -c /opt/web2pyapp_keys/web2pyapp.crt -i 0.0.0.0 -p 8000

web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2016
Version 2.14.6-stable+timestamp.2016.05.09.19.18.48
Database drivers available: sqlite3, imaplib, pymysql, pg8000

please visit:
        https://127.0.0.1:8000/
use "kill -SIGTERM 1284" to shutdown the web2py server

IMPORTANT : Assurez-vous de mettre votre propre mot de passe fort après le -a flag.
Ouvrez un navigateur Web et mettez https://VPS-IP-ADDRESS:8000/ dans la barre de navigation, où VPS-IP-ADDRESS est votre adresse IP VPS.
Acceptez l'avertissement du certificat et la page d'accueil Web2Py devrait apparaître. Pour vous connecter au back-end d'administration, cliquez sur mysites et entrez votre mot de passe, celui que vous avez utilisé lors du démarrage du serveur Web.

Pour arrêter le serveur Web, utilisez la touche CTRL+C key combinaison.

Éviter le terminal ouvert pour maintenir le serveur Web2Py en vie

Étant donné que le service Web2Py nécessite un terminal ouvert pour être actif, une option que vous pouvez utiliser si vous souhaitez quitter le terminal et continuer à travailler consiste à utiliser l'esperluette à la fin de la commande, après quoi vous pouvez quitter la session SSH.

# python /opt/web2pyapp/web2py.py -a 'Password01' -k /opt/web2pyapp_keys/web2pyapp.key -c /opt/web2pyapp_keys/web2pyapp.crt -i 0.0.0.0 -p 8000 &
[1] 1468

Pour arrêter le serveur, utilisez l'ID de processus qui est fourni lorsque vous démarrez le serveur :

# kill -9 1468

Gardez à l'esprit qu'en procédant ainsi, vous risquez de manquer des erreurs ou des avertissements importants susceptibles de s'afficher sur le serveur pendant le développement.

Bien sûr, vous n'avez rien à faire si vous utilisez l'un de nos services d'hébergement VPS Python, auquel cas vous pouvez simplement demander à nos administrateurs Linux experts d'installer Web2Py pour vous. Ils sont disponibles 24h/24 et 7j/7 et prendront immédiatement en charge votre demande.

PS . Si vous avez aimé cet article, partagez-le avec vos amis sur les réseaux sociaux en utilisant les boutons à gauche ou laissez simplement une réponse ci-dessous. Merci.


Cent OS
  1. Comment installer et configurer Nginx sur CentOS 7

  2. Comment installer et configurer samba sur RHEL 8 / CentOS 8

  3. Comment installer et configurer Fail2ban sur CentOS 8

  4. Comment installer et configurer Redis sur CentOS 7

  5. Comment installer et configurer CyberPanel sur CentOS 8

Comment installer et configurer ISPConfig CP sur CentOS 7

Comment installer et configurer ownCloud sur CentOS 7

Comment installer et configurer Samba sur CentOS 8

Comment installer et configurer Fail2ban sur CentOS 8

Comment installer et configurer HAproxy sur CentOS 6

Comment installer et configurer GlusterFS sur CentOS 7/CentOS 8