Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| osdse [2025/03/20 11:55] – [PostgreSQL] david | osdse [2025/04/07 15:55] (current) – [Apache] david | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| Hostname: '' | Hostname: '' | ||
| - | < | + | < |
| ################################################################ | ################################################################ | ||
| # As root : or sudo su | # As root : or sudo su | ||
| Line 35: | Line 35: | ||
| systemctl restart ssh | systemctl restart ssh | ||
| </ | </ | ||
| + | |||
| + | ==== Firewall ==== | ||
| + | See [[server_configuration: | ||
| + | <code bash> | ||
| + | # Allow SSH before we turn on | ||
| + | sudo ufw allow 22 | ||
| + | # Enable Firewall | ||
| + | sudo ufw enable | ||
| + | # View status | ||
| + | ufw status | ||
| + | </ | ||
| + | |||
| + | ==== GitHub ==== | ||
| + | As user (if interaction with git repos is required): | ||
| + | * https:// | ||
| + | * https:// | ||
| + | <code bash> | ||
| + | ssh-keygen -t ed25519 -C " | ||
| + | |||
| + | vi ~/ | ||
| + | </ | ||
| + | |||
| ===== Python ===== | ===== Python ===== | ||
| If you need multiple versions/ | If you need multiple versions/ | ||
| + | |||
| + | ==== Basic (one python) ==== | ||
| Ubuntu searching python versions | Ubuntu searching python versions | ||
| - | < | + | < |
| apt-cache search python3 | grep ' | apt-cache search python3 | grep ' | ||
| apt-cache search python3 | grep -e ' | apt-cache search python3 | grep -e ' | ||
| Line 46: | Line 70: | ||
| Just get the latest full package for this version of Ubuntu (more than we need, but it's not like it's expensive) | Just get the latest full package for this version of Ubuntu (more than we need, but it's not like it's expensive) | ||
| - | < | + | < |
| sudo apt-get install python3-full | sudo apt-get install python3-full | ||
| Line 53: | Line 77: | ||
| </ | </ | ||
| + | Optional (make the word python still point to python3): | ||
| + | <code bash> | ||
| + | sudo apt-get install python-is-python3 | ||
| + | |||
| + | # Test | ||
| + | python --version | ||
| + | </ | ||
| + | |||
| + | ==== pyenv (multiple python versions) ==== | ||
| + | |||
| + | Prerequisite for '' | ||
| + | <code bash> | ||
| + | sudo apt-get install build-essential | ||
| + | </ | ||
| + | |||
| + | Install '' | ||
| + | <code bash> | ||
| + | curl https:// | ||
| + | </ | ||
| + | |||
| + | Make the changes to '' | ||
| + | |||
| + | Then install the python version you wish to have: | ||
| + | <code bash> | ||
| + | pyenv install 3.11 | ||
| + | </ | ||
| + | |||
| + | View python versions: | ||
| + | <code bash> | ||
| + | pyenv versions | ||
| + | </ | ||
| ===== PostgreSQL ===== | ===== PostgreSQL ===== | ||
| see: [[server_configuration: | see: [[server_configuration: | ||
| - | < | + | < |
| apt-cache search postgres | grep ' | apt-cache search postgres | grep ' | ||
| sudo apt-get install postgresql | sudo apt-get install postgresql | ||
| </ | </ | ||
| + | ==== Config ==== | ||
| + | |||
| + | <code bash> | ||
| + | sudo vi / | ||
| + | </ | ||
| + | < | ||
| + | listen_addresses = ' | ||
| + | </ | ||
| + | <code bash> | ||
| + | sudo vi / | ||
| + | </ | ||
| + | < | ||
| + | #host all | ||
| + | host all | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Firewall: | ||
| + | <code bash> | ||
| + | sudo ufw allow 5432 | ||
| + | </ | ||
| + | |||
| + | Configure simple shop: https:// | ||
| ===== MySQL ===== | ===== MySQL ===== | ||
| See: [[server_configuration: | See: [[server_configuration: | ||
| + | ===== Apache ===== | ||
| + | Also see: | ||
| + | * [[server_configuration: | ||
| + | * [[osdse: | ||
| + | |||
| + | Configuration commands: | ||
| + | <code bash> | ||
| + | sudo apt-cache search apache2 | grep php | ||
| + | sudo apt-cache search php | grep mysql | ||
| + | sudo apt-cache search php | grep pgsql | ||
| + | </ | ||
| + | |||
| + | Apache, PHP and connectivity for MySQL & PostgreSQL: | ||
| + | <code bash> | ||
| + | sudo apt-get install apache2 libapache2-mod-php php-mysql php-pgsql | ||
| + | </ | ||
| + | |||
| + | Python: wsgi | ||
| + | <code bash> | ||
| + | sudo apt-cache search apache2 | grep wsgi | ||
| + | </ | ||
| + | |||
| + | Apache, Python: | ||
| + | <code bash> | ||
| + | sudo apt-get install apache2 libapache2-mod-wsgi-py3 | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | sudo ufw app list | ||
| + | |||
| + | sudo ufw allow ' | ||
| + | |||
| + | sudo ufw status | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | # certbot | ||
| + | # python3-certbot-apache : Automates the apache part | ||
| + | sudo apt-get install certbot python3-certbot-apache | ||
| + | |||
| + | sudo certbot --apache | ||
| + | </ | ||
| + | |||
| + | ==== Website & Data Viewer ==== | ||
| + | |||
| + | <code bash> | ||
| + | cd / | ||
| + | sudo vi index.html | ||
| + | |||
| + | </ | ||
| + | <file html index.html> | ||
| + | < | ||
| + | <html lang=" | ||
| + | |||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | <link rel=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <ul> | ||
| + | < | ||
| + | < | ||
| + | </ul> | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Adminer User on DB: | ||
| + | <code bash> | ||
| + | sudo -i -u postgres psql | ||
| + | </ | ||
| + | <code sql> | ||
| + | CREATE USER simple_shop_adminer_reader | ||
| + | |||
| + | \c simple_shop; | ||
| + | |||
| + | -- Grant privileges for simple_shop_adminer_reader (read-only access) | ||
| + | GRANT CONNECT ON DATABASE simple_shop TO simple_shop_adminer_reader; | ||
| + | GRANT USAGE ON SCHEMA public TO simple_shop_adminer_reader; | ||
| + | GRANT pg_read_all_data TO simple_shop_adminer_reader; | ||
| + | </ | ||
| + | |||
| + | Adminer: | ||
| + | <code bash> | ||
| + | sudo mkdir -p sample_data_explore | ||
| + | cd sample_data_explore | ||
| + | sudo wget https:// | ||
| + | sudo vi index.php | ||
| + | </ | ||
| + | |||
| + | <file php index.php> | ||
| + | <?php | ||
| + | function adminer_object() { | ||
| + | |||
| + | class AdminerSoftware extends Adminer { | ||
| + | |||
| + | function name() { | ||
| + | // custom name in title and heading | ||
| + | return ' | ||
| + | } | ||
| + | |||
| + | function database() { | ||
| + | // database name, will be escaped by Adminer | ||
| + | return ' | ||
| + | } | ||
| + | |||
| + | function loginForm() { | ||
| + | echo "< | ||
| + | echo $this-> | ||
| + | echo $this-> | ||
| + | echo "</ | ||
| + | echo "< | ||
| + | echo checkbox(" | ||
| + | } | ||
| + | |||
| + | } | ||
| + | |||
| + | return new AdminerSoftware; | ||
| + | } | ||
| + | |||
| + | include ' | ||
| + | |||
| + | </ | ||
| ====== Junk ====== | ====== Junk ====== | ||