Configuring Ubuntu Server

Changing Hostname & Password

sudo passwd root

sudo hostnamectl set-hostname new-computer-name-here

Installing GUI

Ubuntu-mate-core in this case, is for the sake of easiness in integrating Google Drive

Ref: https://linuxconfig.org/install-gui-on-ubuntu-server-18-04-bionic-beaver

# note that this should be done via vnc to avoid unnecessary compatibility errors
sudo tasksel install ubuntu-mate-core
sudo service lightdm start
The login screen will start, login with root
If any error found after logging saying inappropriate ioctl:

1) open /root/.profile
2) remove mesg || true
3) replace it with:

tty -s && mesg n

Change Timezone

Ref: https://vitux.com/how-to-change-the-timezone-on-your-ubuntu-system/

sudo apt install ntp
sudo unlink /etc/localtime
sudo ln -s /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
timedatectl

Make appropriate settings to ensure local time is always synced with server time
This content is for members only.

Integrating Google Drive compatibility

Integrating Google Drive compatibility as drive mount

Ref: https://www.linuxuprising.com/2018/07/mounting-google-drive-on-xfce-or-mate.html; choosing OCamLFuse as gnome-control-center account is defective as it can’t open mounted GDrive device

This content is for members only.
# OCamLFuse
sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt update
sudo apt install google-drive-ocamlfuse
This content is for members only.
# exit sudo environment by typing: exit
This content is for members only.
# this is unnecessary if you are satisfied with OCAMLFUSE
# prerequisites rust
curl https://sh.rustup.rs -sSf | sh
# Choose option 1 to continue installation
source $HOME/.cargo/env
rustc --version (to verify installation)
# installing gcsf
# depending on the errors you might encountered, sometime you need to install libssl-dev beforehand
sudo apt install libssl-dev
cargo install gcsf
gcsf login ostechnix ; then follow the instruction to authorize app accessing gdrive
mkdir ~/GCSF-GDrive
sudo vi /etc/fuse.conf ; uncomment user_allow_other
gcsf mount ~/GCSF-GDrive -s ostechnix
-- to run process in background
press Ctrl+Z
bg
jobs
--
df -h ; to see where your Google drive is mounted
mount | grep GCSF
sudo fusermount -u ~/GCSF-GDrive ; to unmount

Installing Samba Share

Ref: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-samba-share-for-a-small-organization-on-ubuntu-16-04#step-1-%E2%80%94-installing-samba

This content is for members only.

Install python

Ref: https://linuxize.com/post/how-to-install-python-3-7-on-ubuntu-18-04/

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
python3.7 --version ; to check the installed python version
sudo apt install python3-pip ; install pip3

# set python 3 for default when run python
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
sudo update-alternatives --config python
# choose python3.7 as primary

# install pip
sudo apt install python3-pip
sudo apt install python3-venv

pip3 install virtualenv

----- create snapshot

Create phpmyadmin username & database

This content is for members only.

Configuring mod_wsgi

Tutorial how to use mod_wsgi on Apache https://www.howtoforge.com/tutorial/how-to-run-python-scripts-with-apache-and-mod_wsgi-on-ubuntu-18-04/

Mod_Wsgi with virtual environment https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html

Deploying Django

# open ubuntu shell
export DJANGO_SECRET_KEY='{YOUR_SECRET_KEY}' ; copy from django settings.py
export DJANGO_DB_USERNAME='root'
export DJANGO_DB_PASSWORD='{db_password}'
export DJANGO_DEBUG=False

# uncomment SECRET_KEY and DEBUG in settings.py
# add these new lines
This content is for members only.

# install mysqlclient
# first dont forget to activate virtualenv
sudo apt install python-dev 
sudo apt install default-libmysqlclient-dev
sudo apt install libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
pip install pymysql
pip install mysqlclient
This content is for members only.

Pages: 1 2

Leave a Reply