#Ubuntu Server Setup
Things to do:
[ ] Update Available Package Lists:
# sudo apt-get update
Upgrade installed packages:
# sudo apt-get upgrade
Other Tasks:
# sudo apt-get autoremove
Discover Packages: [https://packages.ubuntu.com][https://packages.ubuntu.com]
Add user to system:
sudo adduser <name>
##Give sudo access to a user: Link to reference
/etc/sudoers.d contains a file for each account allowed. You will create a file in the folder /etc/sudoers.d, named the same as your new user.
Example, user named joe
# sudo -i
# adduser joe
# cd /etc/sudoers.d
# touch joe
# vi joe
Add the following to this file joe
joe ALL=(ALL) NOPASSWD:ALL
Notice that the first word is the same as the user name. Login as this new user, then
execute sudo -i. You should not see the password prompt.
On any system: Generate key pairs
# ssh-keygen
Save to file, which will create a private and public key, key pair. For example if you save the pair to a file such as ~/.ssh/linuxclass
On the remote system. Login as the non-admin user such as
Install public key
# cd ~
# mkdir .ssh
# touch .ssh/authorized_keys
# vi .ssh/authorized_keys
paste the linuxclass.pub into the authorized_keys as one line, then save the file.
# chmod 700 .ssh
# chmod 644 .ssh/authorized_keys
On local system:
# ssh -p 2222 <student>@localhost -i ~/.ssh/linuxclass
# sudo vi /etc/ssh/sshd_config
Find the line similar to:
PasswordAuthentication yes
-- change it to --
PasswordAuthentication no
Deploy Flask app to Apache: https://www.bogotobogo.com/python/Flask/Python_Flask_HelloWorld_App_with_Apache_WSGI_Ubuntu14.php
Edit the file:
/etc/apache2/envvars
Add line:
export APP_DIR=/home/..../path2app/
<VirtualHost *:80>
ServerName MY_SERVER_NAME
WSGIDaemonProcess appname threads=5 home=${APP_DIR}
WSGIScriptAlias / "${APP_DIR}your_app.wsgi"
<Directory "${APP_DIR}">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
Require all granted
WSGIProcessGroup appname
WSGIApplicationGroup %{GLOBAL}
</Directory>
</VirtualHost>
- [Ubuntu Packages](https://packages.ubuntu.com])
- [Enable sudo without passwords](https://phpraxis.wordpress.com/2016/09/27/enable-sudo-without-password-in-ubuntudebian/)