Goal definition

When you're dived in depth of software development with Debian as a main operational system sometimes it might emerge the urge to install it on a new host. As the current environment is homely and handy to use thus the aim is just to replicate it.

Test launch

First operation after successful installation is a test launch with

# dmesg -w

as an insurance procedure. As you might guess this is a debug messages output which allows to detect all kind of deviation at the early stages.

And, as you might expect, if something goes wrong it should be written in to logs:

# ls -la /var/log/
total 70024
drwxr-xr-x  7 root              root           4096 Aug  5 00:05 .
drwxr-xr-x 11 root              root           4096 Jul 10 15:27 ..
-rw-r--r--  1 root              root              0 Aug  1 07:16 alternatives.log
drwxr-xr-x  2 root              root           4096 Aug  3 13:31 apt
-rw-r-----  1 root              adm        14083418 Aug  5 11:33 auth.log
-rw-r--r--  1 root              root          50838 Jun 20 04:14 bootstrap.log
-rw-rw----  1 root              utmp       21596928 Aug  5 11:33 btmp
-rw-r-----  1 root              adm          251415 Aug  5 11:14 daemon.log
-rw-r-----  1 root              adm           41298 Aug  5 09:51 debug
-rw-r--r--  1 root              root          52316 Aug  3 13:32 dpkg.log
-rw-r--r--  1 root              root          24072 Jul 11 17:56 faillog
-rw-r--r--  1 root              root           7249 Jun 20 04:30 fontconfig.log
drwx--x--x  2 root              Debian-gdm     4096 Jun  6 21:17 gdm3
drwxr-xr-x  3 root              root           4096 Jul 10 15:31 installer
-rw-r-----  1 root              adm          304134 Aug  5 11:16 kern.log
-rw-rw-r--  1 root              utmp         292876 Aug  5 11:14 lastlog
-rw-r-----  1 root              adm         2358943 Aug  5 11:16 messages
drwx------  2 speech-dispatcher root           4096 Mar  6 00:13 speech-dispatcher
-rw-r-----  1 root              adm           65851 Aug  5 11:17 syslog
drwxr-x---  2 root              adm            4096 Aug  1 07:16 unattended-upgrades
-rw-r-----  1 root              adm         2103293 Aug  5 10:07 user.log
-rw-rw-r--  1 root              utmp          18048 Aug  5 11:14 wtmp
-rw-r--r--  1 root              root            279 Jul 31 07:41 wvdialconf.log

Thus it would easy to catch a bug by tracing it through Debian 9 logs.

Kernel modules

Deviation detection

In several (mostly rare) cases Linux kernel can't work correctly with your hardware and point on this by messages (dmesg and /var/log/ also). The general concept is:

If something goes wrong it must do it loudly!

thus, in incorrect work case kernel fills the log with the ERROR messages and it should easily detected by user.

Causation

It's easy, as a day: hardware incompatibility - sometimes arbitrary piece of your PC might be equipped by proprietary hardware (e.g. Wi-Fi card from Atheros, or Bluetooth adapter from unknown manufacturer). That's it - it just deny to serve as expected by the Kernel. All you might need a set of proprietary drivers on your device.

Blacklisting as a cure

In flip side: when you're got a tons of Error messages and device is stubborn as a mule, it is unavoidable.

There are a lot of approaches how to blacklist, and the stem idea is to expel erroneous modules out from usage by the Kernel.

HDD health check-up

For notebook's HDD with ferromagnetic disks only Not suitable for SSD

The main issue with it is a number of load cycles. It is a count of times when magnetic heads hided into the stress-safe position. This event is enough noisy usually, but to ensure that your drive works properly:

  • Install:

    # apt-get install smartmontools
    
  • Overview your /dev/sdx:

    # smartctl -i /dev/sda
    # smartctl -A /dev/sda
    
  • Check-up number:

    # smartctl -A /dev/sda | grep Load
    

In case when this number grows dramatically fast, follow this link, please, to fix this issue.

Software installation

General purpose

apt-get install -y htop emacs25 emacs25-common-non-dfsg gkrellm \
openssh-server virtualenv sqlite3 mariadb-client mariadb-server git \
postgresql-doc postgresql postgresql-client pgadmin3 pgadmin3-data

Docker

Initial source is an official Docker site

# apt-get remove docker docker-engine docker.io
# apt-get update
# apt-get install apt-transport-https /
  ca-certificates curl gnupg2 software-properties-common
# curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
# apt-key fingerprint 0EBFCD88
# add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/debian \
			 $(lsb_release -cs) \
			 stable"
# apt-get update
# apt-get install docker-ce
docker --version
Docker version 17.06.0-ce, build 02c1d87

Post-installation procedures

Jenkins

Jenkins is an open source continuous integration tool written in Java and released under the MIT License. It is a server-based system running in a servlet container such as Apache Tomcat.

LTS version

# wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | apt-key add -
# echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" | tee -a /etc/apt/sources.list

# apt-get update
# apt-get install jenkins -y

After that it would be feasible to login to Jenkins at localhost:8080 For secure necessity you'll be owe to enter password allocated in file with root access only.

# nano /var/lib/jenkins/secrets/initialAdminPassword

Source

VirtualBox

touch /etc/apt/sources.list.d/virtualbox.list
echo "deb http://download.virtualbox.org/virtualbox/debian stretch contrib" | tee -a /etc/apt/sources.list.d/virtualbox.list
curl -O https://www.virtualbox.org/download/oracle_vbox_2016.asc
apt-key add oracle_vbox_2016.asc
apt-get update
apt-get install virtualbox-5.1

Skype

Easy peasy.

Source

HangOuts

Unfortunately it is impossible to install it as a single app, but only as Google Chrome plugin. To do so:

# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# dpkg -i google-chrome-stable_current_amd64.deb

After that you should download and install google-talkplugin_current_amd64.deb

FileTree extension

A tree utility is an extremely handy tool in file-system dissection.

# apt-get install tree

Check the existing folders

As I'm expect to store my data locally and I'm a user in generic sense of this word, lets check-up /usr/local/ directory as a potential storage for my data.

tree -L 1 /usr/local/
/usr/local/
├── bin
├── etc
├── games
├── include
├── lib
├── man -> share/man
├── sbin
├── share
└── src

9 directories, 0 files
tree -L 2 /usr/local/lib/
/usr/local/lib/
├── python2.7
│   ├── dist-packages
│   └── site-packages
└── python3.5
    └── dist-packages

5 directories, 0 files

tree -L 2 /usr/local/share/
/usr/local/share/
├── anki
│   ├── anki.xml
│   ├── bin
│   ├── Makefile
│   └── README
├── applications
│   ├── anki.desktop
│   └── mimeinfo.cache
├── ca-certificates
├── emacs
│   ├── 25.1
│   └── site-lisp
├── fonts
├── man
│   └── man1
├── pixmaps
│   ├── anki.png
│   └── anki.xpm
├── sgml
│   ├── declaration
│   ├── dtd
│   ├── entities
│   ├── misc
│   └── stylesheet
└── xml
    ├── declaration
    ├── entities
    ├── misc
    └── schema

22 directories, 5 files

Conclusion

Seems like the best place to put any data on UNIX host is /usr/local/ that have lib and share folders which are the pertinent place for shared data and some library-like one.

On my point of view the most convenient place to put some shared data on your Debian 9 host is /usr/local/share/

Check-up user groups

By default convention the user don't allowed to write into /usr/local/, but staff group is a special case:

staff: Allows users to add local modifications to the system (/usr/local) without needing root privileges…

Initially it is an empty group, there are no users in it:

groups | grep staff
echo "---"
groups alioth | grep staff
---

Add user to group staff

# usermod -aG staff alioth

or equivalent:

# adduser alioth staff

Re-login

To up-to-date group permissions.

And check groups now:

groups | grep staff
echo "==="
groups alioth | grep staff
alioth cdrom floppy sudo audio dip video plugdev staff netdev bluetooth scanner
===
alioth : alioth cdrom floppy sudo audio dip video plugdev staff netdev bluetooth scanner

Testing

Is it possible to touch file in /usr/local/share/ right now?

cd /usr/local/share/
touch test.file.txt
ls -la | grep test
rm test.file.txt
echo "++++"
ls -la | grep test
-rw-r--r--  1 alioth staff     0 Aug  2 18:39 test.file.txt
++++

Additional folders

Now, when you're added into staff group it would be possible to execute any secure command from current user. Let's create in /usr/local/ several additional folders for books, courses and repositories:

Target directory overview

ls -la /usr/local/
ls -la /usr/local/lib/
ls -la /usr/local/share/
# mkdir books courses
total 44
drwxrwsr-x 11 root   staff 4096 Aug 25 09:39 .
drwxr-xr-x 11 root   root  4096 Aug 15 03:54 ..
drwxrwsr-x  2 root   staff 4096 Aug  2 19:24 bin
drwxrwsr-x  2 root   staff 4096 Jul 23 06:13 etc
drwxrwsr-x  2 root   staff 4096 Jul 23 06:13 games
drwxr-sr-x  5 alioth staff 4096 Aug  5 16:37 git
drwxrwsr-x  2 root   staff 4096 Jul 23 06:13 include
drwxrwsr-x  4 root   staff 4096 Jul 31 20:19 lib
lrwxrwxrwx  1 root   staff    9 Jul 31 20:19 man -> share/man
drwxrwsr-x  2 root   staff 4096 Jul 23 06:13 sbin
drwxrwsr-x 12 root   staff 4096 Aug  3 19:22 share
drwxrwsr-x  2 root   staff 4096 Jul 23 06:13 src
total 16
drwxrwsr-x  4 root staff 4096 Jul 31 20:19 .
drwxrwsr-x 11 root staff 4096 Aug 25 09:39 ..
drwxrwsr-x  4 root staff 4096 Jul 31 20:19 python2.7
drwxrwsr-x  3 root staff 4096 Jul 31 20:19 python3.5
total 48
drwxrwsr-x 12 root   staff 4096 Aug  3 19:22 .
drwxrwsr-x 11 root   staff 4096 Aug 25 09:39 ..
drwxr-sr-x  3 root   staff 4096 Aug  2 19:24 anki
drwxr-sr-x  2 root   staff 4096 Aug 17 16:09 applications
drwxr-sr-x  4 alioth staff 4096 Aug  3 19:24 arch
drwxrwsr-x  2 root   staff 4096 Jul 23 06:20 ca-certificates
drwxrwsr-x  4 root   staff 4096 Aug  2 19:23 emacs
drwxrwsr-x  2 root   staff 4096 Jul 23 06:20 fonts
drwxrwsr-x  3 root   staff 4096 Aug  2 19:24 man
drwxr-sr-x  2 root   staff 4096 Aug  2 19:24 pixmaps
drwxrwsr-x  7 root   staff 4096 Jul 31 20:19 sgml
drwxrwsr-x  6 root   staff 4096 Jul 31 20:19 xml

Git

Settings

mkdir /usr/local/git/
git config --global user.email "a.s.kosinov@gmail.com"
git config --global user.name "Anton S. Kosinov"
git config --global credential.helper 'cache --timeout=3600'

Persistent connection

In case when you would use your Debian as ssh host, which by default settings just drop out all suspended connections. In intention to prevent this, just add these stirngs at the bottom of /etc/ssh/sshd_config:

ClientAliveInterval 120
ClientAliveCountMax 720

and reboot the daemon:

# service sshd restart

Software development environment configuring

Version control systems

Any contemporary software development inevitably tied with version control systems there Git and Mercurial deserve to be noticed. Thus it would be a wise decision to provide folder separation for these VCS locally on your HD:

mkdir /usr/local/git/ /usr/local/hg/

After that it might be easily cloned some particular content there. And let call this schema folder per VCS

User separation might avert any mess when there are several users. Respectively it might be accomplishing in our case by:

mkdir /usr/local/git/0--key/ /usr/local/git/annelida/

Now, when you're prepared place where to allocate your forks or clones - it's very time to clone it there.

Cloning repositories

Exactly for clarity purpose it would be useful to utilize folder per user schema, with inner repositories allocation.

mkdir /usr/local/git/0--key/
cd /usr/local/git/0--key/
git clone https://github.com/0--key/lib.git
git clone https://github.com/0--key/org-pub.git
git clone https://github.com/0--key/0--key.github.io.git

as a result you should get something around this:

tree -L 2 /usr/local/git/
/usr/local/git/
├── 0--key
│   ├── 0--key.github.io
│   ├── lib
│   ├── nltk
│   ├── org-pub
    └── talk-python-transcripts

Emacs' settings linkage

As I'm prefer to store my Emacs' settings in the Git cloud.

ln -s -T /usr/local/git/0--key/lib/Emacs/default.lenovo.el \
/usr/local/share/emacs/site-lisp/default.el
ln -s -T /usr/local/git/0--key/lib/Emacs/init_generic.el \
~/.emacs.d/init.el

Emacs' packages sync

It's a routine task, thus there is a simple and native solution.

  • Find out custom-set-variables section in your init.el
  • Evaluate it by M-x eval-region
  • Now look on package-selected-packages variable

    (print package-selected-packages)
    
    
    (org bookmark+ color-theme elfeed elpy google-translate howdoi key-chord magit marshal org-bullets org-pomodoro pcache travis voca-builder ereader docker)
    
    
  • C-h v package-selected-packages
  • Ensure package-selected-packages is fulfilled (not nil)
  • package-install-selected-packages
  • DONE

Redundant files deletion

To force Org work properly after installation you should delete all *.elc files out from its source folder. E.g.

rm ~/.emacs.d/elpa//org-20170731/*.elc

and restart Emacs by C-x C-c:

(save-buffers-kill-terminal)

Info generation

It's easy:

# apt-get install install-info

Now just type C-h i and enjoy!

Note

emacs25-common-non-dfsg contains all necessary info files and should be installed preliminary

Virtual Environment

Is a cool feature to use in daily work for each developer. Thus it is necessary to assign a semantically pertinent path to allocate all theirs venvs in some particular folder:

mkdir -p /usr/local/share/DVCS/alioth
mkdir -p /usr/local/share/DVCS/vikky

E.g. two our users would place the individual version of venvs in separate folders.

Suppose you're alerady installed virtualenv on your system. Thus:

python --version
virtualenv -p /usr/bin/python3 /usr/local/share/DVCS/alioth/venv3
Python 2.7.13
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /usr/local/share/DVCS/alioth/venv3/bin/python3
Also creating executable in /usr/local/share/DVCS/alioth/venv3/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

Try to overview your venv:

tree -L 1 /usr/local/share/DVCS/alioth/venv3/
/usr/local/share/DVCS/alioth/venv3/
├── bin
├── lib
└── share

3 directories, 0 files

Seems like all jobe is done and let's activate our venv:

(pyvenv-activate "/usr/local/share/DVCS/alioth/venv3/")

Check-up results:

python --version
Python 3.5.3

And let's return into innate state:

(pyvenv-deactivate)
python --version
Python 2.7.13

Tip

It is cool feature to switch virtual environment inside Emacs. Just try to utilize pyvenv:

M-x pyvenv[TAB]

Possible completions are: pyvenv-activate pyvenv-deactivate pyvenv-menu pyvenv-mode pyvenv-restart-python pyvenv-tracking-mode pyvenv-workon

Please, choose any command with no interruption on Emacs' work-flow.

Python packages installation

It is a good idea to utilize the isolated DevEnv for Python and it demands to install several handy packages into each DevEnv.

pip install jedi yapf flake8 autopep8

Grammar

The main target is in creation of grammatically correct textes, even though Emacs has an advanced grammar-checker, lets extend it ability by external plug-in.

java -version
ls -la /usr/local/java/
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
ls: cannot access '/usr/local/java/': No such file or directory

Testing

VirtualBox

Installation

USB access

# usermod -aG vboxusers alioth

After this you must to re-login to savor these changes.



blog comments powered by Disqus

Published

28 June 2017

Categories

Debian DevEnv

Tags