Last active
January 27, 2019 09:31
-
-
Save OHua/b4025c8869873708262792fb49aa73a4 to your computer and use it in GitHub Desktop.
Now i can copy/paste ... it's too tired to type each words by hand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**Ubuntu | |
sudo gedit /etc/default/apport => enabled = 0 | |
sudo apt-get update | |
(option)sudo apt update && sudo apt upgrade | |
**Python | |
sudo apt-get install python3-pip | |
sudo apt-get install python3-tk (for matplotlib) | |
(option) sudo pip3 install virtualenv | |
**Apache | |
sudo apt-get install apache2 | |
sudo apt-get install libapache2-mod-wsgi-py3 | |
**MySQL | |
sudo apt-get install mysql-server => password => confirm password | |
sudo apt-get install libmysqlclient-dev ( to get mysql_config , then we can install mysqlclient ) | |
(option)mysql_secure_installation | |
mysql -uroot -p => password | |
CREATE DATABASE test2 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
**Source Code | |
sudo apt-get install openssh-server | |
sudo apt-get install git | |
(optioin)git --bare init | |
git clone git@yourserverhostname:/path/to/repository.git => password | |
sudo virtualenv testenv | |
source testenv/bin/activate (in venv you can use pip instead pip3) | |
pip install mysqlclient ( Python interface to MySQL ) | |
(optioin)pip install django | |
(optioin)django-admin startproject myprojectname | |
(optioin)cd myprojectname ; python manage.py startapp mywebappname | |
(option)pip freeze > requirements.txt | |
pip install -r requirements.txt | |
python manage.py migrate | |
python manage.py shell | |
python manage.py loaddata fixtures/initialdata.json | |
(option)python manage.py collectstatic | |
python manage.py runserver => localhost:8000 | |
sudo chgrp -R www-data media | |
sudo chmod -R g+w media | |
gedit settings.py => ALLOWED_HOSTS += [ '172.17.8.%s' %(i) for i in range(256) ] | |
sudo service apache2 restart | |
python manage.py createsuperuser => email => password | |
**Ubuntu | |
sudo adduser your_account_name | |
sudo deluser your_account_name | |
(option)lsb_release -a | |
**Crontab | |
(option)crontab -l | |
crontab -e => */1 * * * * /usr/bin/python3 /home/username/path/to/test.py | |
(important) remember add "\n" foreach line in crontab -e | |
(important) use absolute path | |
(option)#!/usr/bin/python3 | |
(option)chmod a+x test.py | |
(option)https://help.ubuntu.com/community/CronHowto | |
(option)https://stackoverflow.com/questions/8727935/execute-python-script-on-crontab | |
(option)"grep CRON /var/log/syslog" or "tail -f /var/log/syslog | grep CRON" | |
(option)use "env DISPLAY=:0" if you want display some gui process | |
(option)there is no need to use "sudo service cron restart" | |
(option)there is no need to use "/etc/cron.allow" or "/etc/cron.d/cron.allow" | |
** docker install step | |
(option)https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce | |
sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
(option)sudo apt-key fingerprint 0EBFCD88 | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
sudo apt-get install docker-ce | |
(option) sudo docker --version | |
scp [email protected]:/home/sid/codebase/aibd/Dockerfile . | |
## install docker compose | |
(option)https://docs.docker.com/compose/install/#install-compose | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
sudo docker-compose up | |
(option)sudo docker-compose down | |
(option)sudo docker container ls | |
(option) | |
(option) | |
(option) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment