guillaume-philippon / slam-v2

Super LAN Address Manager
0 stars 1 forks source link

SLAM Quick intallation guide

This installation guide applies to SLAM v2. It was written based on CentOS 8 but should work on CentOS too. The most critial requirement is Python 3 which is available on both platforms through Python distribution like PyEnv or Anaconda.

OS installation

# yum install -y epel-release
# yum -y update
# yum install -y git mariadb-server mariadb-devel

MariaDB configuration

# systemctl enable mariadb
# systemctl start mariadb
# mysql -h localhost -u root
MariaDB [(none)]> create database slam character set utf8;;
MariaDB [(none)]> grant all privileges on slam.* to 'slamdb'@'localhost' identified by 'slamdbpass';
MariaDB [(none)]> quit;

Python installation and configuration

It is recommended to install a Python distribution independent of the OS distribution as Python provided by the OS is driven by OS needs and tends to be a source of problems with dependencies used in application like SLAM. It is also recommended to use a distribution allowing to define a "virtual environment" for the application, to isolate from Python configuration changes driven by other applications. The current guide describe such an installation using PyEnv. The current guide assumes PyEnv will be installed in /opt/pyenv and that SLAM will be installed under /opt/slam but you can use the location you want.

SLAM installation

SLAM must be installed from sources.

  cd /opt/slam
  git clone https://github.com/guillaume-philippon/slam-v2.git

SLAM configurartion

SLAM configuration must be customized to reflect your site configuration by editing the file slam/settings.py in /opt/slam/slam_v2. You need to review all settings containing paths or URLs to adapt them to your site. In particular the default DATABASE variable must be replaced by something similar to :

```
DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'OPTIONS': {
        'read_default_file': os.path.join(BASE_DIR, 'my.cnf')
        }
    }
}

Once `setting.py` has been properly configured, run the following commands:

   ```bash
   cd /opt/slam/slam_v2
   python ./manage.py makemigrations
   python ./manage.py migrate
   python ./manage.py createsuperuser    # to create a administrator