Skip to content

Commit 2145226

Browse files
ines-cruzlnielsen
authored andcommitted
docs: Adds a system setup guide for linux
1 parent 9bc1955 commit 2145226

File tree

1 file changed

+228
-3
lines changed

1 file changed

+228
-3
lines changed

docs/getting-started/development-environment.rst

+228-3
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,235 @@ See https://docs.docker.com/docker-for-mac/#resources.
175175
A typical sign of needed more resources, is that services are not running or
176176
images are having problems building.
177177

178-
Linux
179-
~~~~~
178+
Ubuntu
179+
~~~~~~
180+
181+
System setup guide for Ubuntu.
182+
183+
**General tools/packages useful during development:**
184+
185+
.. code-block:: sh
186+
187+
$ apt install git-all # Distributed version control system
188+
$ apt-get install sqlitebrowser # UI for SQLite
189+
$ snap install spectacle # Organise windows with keyboard shortcuts
190+
$ apt-get install libcairo2-dev # Graphics library
191+
$ apt-get install htop # A better top
192+
$ apt-get install tree # Pretty print a directory structure
193+
$ apt install wget # Http client
194+
$ apt-get install hub # Extends git with github features
195+
$ apt-get install bash-completion # If bash is used as shell
196+
$ apt install sshuttle iptables # Needed for tunneling into CERN.
197+
198+
**Docker**
199+
200+
To install docker you can follow the instructions in `docker for Ubuntu. <https://docs.docker.com/engine/install/ubuntu/>`_
201+
202+
If you get the following error after installing Docker and running simple commands:
203+
204+
.. code-block:: console
205+
206+
Got permission denied ... /var/run/docker.sock: connect: permission denied
207+
208+
see `here <https://stackoverflow.com/questions/48568172/docker-sock-permission-denied/>`_ for some tips on how to solve it.
209+
210+
**docker-compose**
211+
212+
For defining and running multi-container Docker applications.
213+
214+
.. code-block:: console
215+
216+
$ sudo apt install docker-compose
217+
218+
**Google chrome**
219+
220+
Needed for some end-to-end tests.
221+
222+
.. code-block:: console
223+
224+
$ sudo apt install gdebi-core wget
225+
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
226+
$ sudo gdebi google-chrome-stable_current_amd64.deb
227+
228+
**OC CLI**
229+
230+
Needed if you deploy on openshift.
231+
232+
Download the latest OpenShift Origin files. As of this writing, that version number is 3.11.0.
233+
234+
.. code-block:: console
235+
236+
$ wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
237+
238+
Once the file is downloaded, extract it with the command:
239+
240+
.. code-block:: console
241+
242+
$ tar xvzf openshift*.tar.gz
243+
244+
Change into the newly-created directory with the command:
245+
246+
.. code-block:: console
247+
248+
$ cd openshift-origin-client-tools*/
249+
250+
Move the kubectl and oc binaries with the command:
251+
252+
.. code-block:: console
253+
254+
$ sudo mv oc kubectl /usr/local/bin/
255+
256+
**Installation problems**
257+
If during the installation you encounter broken packages, try the follwoing command:
258+
259+
.. code-block:: sh
260+
261+
$ sudo apt --fix-broken install
262+
263+
**Python**
264+
265+
Invenio is developed using Python and JavaScript.
266+
267+
268+
If you want to check which version of Python you have, try the following:
269+
270+
.. code-block:: sh
271+
272+
# Check the system Python version
273+
$ python --version
274+
275+
# Check the Python 2 version
276+
$ python2 --version
277+
278+
# Check the Python 3 version
279+
$ python3 --version
280+
281+
To install Python 3.8 type the following commands:
282+
283+
.. code-block:: sh
284+
285+
$ sudo apt-get update
286+
$ sudo apt-get install python3.8 python3-pip
287+
288+
In the following `list <https://invenio.readthedocs.io/en/latest/getting-started/quickstart/installation.html#prerequisites/>`_ you can check if your system has the necessary requirements.
289+
290+
We highly recommend that install ``pyenv`` and ``nvm`` - both tools manage version of python and node
291+
respectively. Install the following packages:
292+
293+
**nvm**
294+
295+
.. code-block:: console
296+
297+
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
298+
299+
To check if you have the latest version of node installed type the following commands:
300+
301+
.. code-block:: sh
302+
303+
$ sudo npm cache clean -f
304+
$ sudo npm install -g n
305+
$ sudo n stable
306+
307+
**Pyenv**
308+
309+
Update and install the required dependencies.
310+
311+
.. code-block:: console
312+
313+
$ sudo apt update -y
314+
$ sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
315+
316+
Clone the repository
317+
318+
.. code-block:: console
319+
320+
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
321+
322+
Configure the environment.
323+
324+
.. code-block:: console
325+
326+
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
327+
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
328+
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
329+
330+
Restart shell.
331+
332+
.. code-block:: console
333+
334+
$ exec "$SHELL"
335+
336+
**Pipenv**
337+
338+
Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip and virtualenv. We suggest the following installation guide:
339+
340+
https://realpython.com/pipenv-guide/#pipenv-introduction
341+
342+
**virtualenv**
343+
344+
virtualenv is a CLI tool that needs a Python interpreter to run. We recommend the following installation guide:
345+
346+
https://virtualenv.pypa.io/en/latest/installation.html
347+
348+
**virtualenvwrapper**
349+
350+
Note that after the installation, virtualenvwrapper.sh can be found in ~/.local/bin
351+
352+
.. code-block::
353+
354+
$ pip3 install --user virtualenvwrapper
355+
356+
Once you have installed above packages, you can proceed with installing Python versions.
357+
The following will install Python 3.6, 3.7 and 3.8 and set the default Python installation to Python 3.8 (node you can always install the latest patch-level release):
358+
359+
.. code-block:: console
360+
361+
$ pyenv install 3.6.9
362+
$ pyenv install 3.7.8
363+
$ pyenv install 3.8.5
364+
$ pyenv global 3.8.5
365+
366+
367+
You should edit your `.bashrc` or `.zshrc` file to initialise pyenv:
368+
369+
.. code-block:: sh
370+
371+
# nvm setup
372+
export NVM_DIR="$HOME/.nvm"
373+
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"
374+
375+
# pyenv
376+
eval "$(pyenv init -)"
377+
378+
# pyenv-virtualenv
379+
eval "$(pyenv virtualenv-init -)"
380+
381+
# pyenv-virtualenvwrapper
382+
pyenv virtualenvwrapper
383+
384+
Now, you can create e.g. Python virtual environments using the following
385+
commands:
386+
387+
.. code-block:: console
388+
389+
$ mkvirtualenv <name>
390+
$ mkvirtualenv -p python3.7 <name>
391+
$ workon <name>
392+
393+
394+
To deactivate the virtual environment simple type:
395+
396+
.. code-block:: console
397+
398+
$ deactivate
399+
400+
**cookiecutter**
401+
402+
Tool to bootstrap new modules from templates.
403+
404+
.. code-block:: console
180405
181-
Want to write it? Contact us on the chat!
406+
pip install cookiecutter
182407
183408
Editor
184409
------

0 commit comments

Comments
 (0)