Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
vms:python:django [2015/08/07 16:29] admin [Python 3] |
vms:python:django [2017/04/14 01:05] (current) admin [Using a Shared Folder to Host your Projects] |
||
|---|---|---|---|
| Line 25: | Line 25: | ||
| ----- | ----- | ||
| ===== Debian VM ===== | ===== Debian VM ===== | ||
| - | We'll start with a [[debian|Debian template]].\\ | + | We'll start with a [[..:debian|Debian template]].\\ |
| Then: | Then: | ||
| <code> | <code> | ||
| Line 59: | Line 59: | ||
| > nano /etc/hostname | > nano /etc/hostname | ||
| > nano /etc/hosts | > nano /etc/hosts | ||
| - | > reboot | ||
| </code> | </code> | ||
| Line 76: | Line 75: | ||
| === Put your public rsa key for login === | === Put your public rsa key for login === | ||
| - | (From your workstation) | + | (From the host system) |
| <code> | <code> | ||
| > ssh-copy-id -i root@<host.ip.address> | > ssh-copy-id -i root@<host.ip.address> | ||
| </code> | </code> | ||
| - | === Upgrade system & install sudo === | + | You might want to reboot the VM at this point and login through a terminal instead of using the VirtualBox restricted screen. |
| + | |||
| + | === Install sudo === | ||
| As root: | As root: | ||
| <code> | <code> | ||
| - | > apt-get update | ||
| - | > apt-get upgrade | ||
| > apt-get install sudo | > apt-get install sudo | ||
| </code> | </code> | ||
| Line 94: | Line 93: | ||
| </code> | </code> | ||
| + | |||
| + | Adding to the sudoers group: | ||
| + | <code> | ||
| + | > sudo usermod -a -G sudo <username> | ||
| + | </code> | ||
| ---- | ---- | ||
| ==== Install VirtualBox Guest Additions ==== | ==== Install VirtualBox Guest Additions ==== | ||
| Line 151: | Line 155: | ||
| Enter new UNIX password: | Enter new UNIX password: | ||
| Retype new UNIX password: | Retype new UNIX password: | ||
| - | > sudo usermod -a -G sudo webdev | ||
| </code> | </code> | ||
| Line 162: | Line 165: | ||
| === Creating a shared folder for your development environment === | === Creating a shared folder for your development environment === | ||
| ----- | ----- | ||
| - | [[http://wiki.strategicz.com/vhyper/doku.php?id=vms:webdev:apache#create_the_shared_www_folders]] | + | You have to create a **shared folder** for your VM, then "prepare" it for correct symlinks operations from your **host** computer command line: See [[vms:webdev:apache#create_the_shared_www_folders|Create VirtualBox shared folder]] in this wiki. |
| Test-mount your shared folder: | Test-mount your shared folder: | ||
| Line 185: | Line 188: | ||
| > sudo mount -a | > sudo mount -a | ||
| </code> | </code> | ||
| + | |||
| + | <WRAP center round tip 100%> | ||
| + | If the system crashes at boot time, you probably need to have the ''vboxsf'' module to be loaded early, before the mounting of file systems. | ||
| + | Simply add a line containing ''vboxsf'' to ''/etc/modules'' and reboot, this should fix the problem. | ||
| + | |||
| + | Another solution is to set ''noauto'' in ''/etc/fstab'' and manually mount drives in ''/etc/rc.local'', but other services are launched beforehand... | ||
| + | </WRAP> | ||
| + | |||
| <WRAP center round important> | <WRAP center round important> | ||
| Line 255: | Line 266: | ||
| ---- | ---- | ||
| ==== Python virtual environment (virtualenv) ==== | ==== Python virtual environment (virtualenv) ==== | ||
| - | ----- | + | |
| A quick intro about Python virtual environments [[http://sametmax.com/les-environnement-virtuels-python-virtualenv-et-virtualenvwrapper/|can be found here (in french)]]. | A quick intro about Python virtual environments [[http://sametmax.com/les-environnement-virtuels-python-virtualenv-et-virtualenvwrapper/|can be found here (in french)]]. | ||
| Line 263: | Line 274: | ||
| Apparently pip does the same, but better. | Apparently pip does the same, but better. | ||
| - | Under Wheezy: | + | **NOTE**: It seems that on most distribution, if you're running Python 2.7.9+ or Python 3.4+, pip should already be available. This is not the case in Debian. |
| + | |||
| + | With Python 2: | ||
| <code> | <code> | ||
| > sudo apt-get install python-pip python-dev build-essential | > sudo apt-get install python-pip python-dev build-essential | ||
| </code> | </code> | ||
| + | |||
| + | When using python 3: | ||
| + | <code> | ||
| + | > sudo apt-get install python3-pip python3-dev build-essential | ||
| + | </code> | ||
| + | |||
| Install virtualenv: | Install virtualenv: | ||
| <code> | <code> | ||
| > pip install virtualenv | > pip install virtualenv | ||
| + | OR | ||
| + | > pip3 install virtualenv | ||
| </code> | </code> | ||