Advertisement
E-werd

Throat Install Guide, base Debian Linux 10.0 MariaDB

Aug 7th, 2019
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. Title: Throat Install Guide, base Debian Linux 10.0 MariaDB
  2.  
  3. ###
  4. ### Assume basic installation of Debian Linux, openssh server installed and setup, a non-root user created and added to /etc/sudoers
  5. ###
  6.  
  7. ## Switch to root and install dependencies
  8. sudo su -
  9. apt install -y git redis-server build-essential python3 python3-pip libmagic-dev libexiv2-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget libffi-dev libboost-python-dev arcanist curl libssl-dev mariadb-server mariadb-client default-libmysqlclient-dev npm
  10.  
  11. ## This is needed for the pip stage later on
  12. ln -s /usr/lib/x86_64-linux-gnu/libboost_python37.so /usr/lib/x86_64-linux-gnu/libboost_python36.so
  13.  
  14. ## Create user under which throat is installed and switch to it.
  15. adduser --disabled-password --gecos "" app
  16. su - app
  17.  
  18. ## Setup pyenv
  19. curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  20. echo 'export PATH="/home/app/.pyenv/bin:$PATH"' >> ~/.profile
  21. echo 'eval "$(pyenv init -)"' >> ~/.profile
  22. echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile
  23. exit
  24.  
  25. ## Database setup
  26. mysql_install_db --user=mysql --datadir=/var/lib/mysql
  27. systemctl mariadb start
  28. mysqladmin -u root password "Pass1234"
  29. Systemctl enable mariadb
  30. mysql -u root -p
  31. CREATE DATABASE throat;
  32. CREATE USER 'throat'@localhost IDENTIFIED BY 'Pass1234';
  33. GRANT ALL PRIVILEGES ON throat.* TO 'throat'@localhost;
  34. exit
  35.  
  36. ## Start redis and add to startup
  37. systemctl enable redis-server
  38. systemctl start redis-server
  39.  
  40. ## Switch back to app and install python and set virtualenv
  41. su - app
  42. pyenv install 3.6.8
  43. pyenv virtualenv 3.6.8 app
  44.  
  45. ## Download throat, build css, assign dir to aforementioned virtualenv
  46. git clone https://phab.phuks.co/source/throat.git
  47. cd throat
  48. npm install
  49. npm run build
  50. pyenv local app
  51.  
  52. ## Upgrade pip, get requirements
  53. pip install --upgrade pip
  54. pip install -r requirements.txt
  55. pip uninstall werkzeug
  56. pip install werkzeug==0.16.0
  57.  
  58. ## Create and modify config
  59. cp example.config.yaml config.yaml
  60. nano config.yaml
  61.  
  62. ##
  63. ## Database connection configuration
  64. ##
  65.  
  66. ## Comment out DATABASE_URL and add in the following:
  67.  
  68. DATABASE = {
  69. 'host': 'localhost',
  70. 'name': 'throat',
  71. 'engine': 'MySQLDatabase',
  72. 'charset': 'utf8mb4',
  73. 'user': 'throat',
  74. 'password': 'Pass1234',
  75. }
  76.  
  77. ## Setup database
  78. scripts/migrate.py
  79.  
  80. ## to be able to access it from outside localhost...
  81. nano wsgi.py
  82. #add ", host='0.0.0.0'" to "socketio.run(app, debug=True)" inside parentheses
  83.  
  84. ## to run: ./wsgi.py
  85. ## find IP of your machine (ifconfig), visit: http://<ip address>:5000
  86.  
  87. ## Create an account for admin, close wsgi, then run:
  88. scripts/admins.py --add admin
  89.  
  90. ## To add created subs to defaults:
  91. scripts/defaults.py -a subname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement