User:Dvorapa/Toolforge for beginners/Tool environment
Once you know how to use the tool, you maybe wonder how to adjust its environment to your needs. Perhaps you are asking, how to adjust the command line colors or some other behavior, set specific command preferences or aliases, perhaps install specific package or specific version, etc. Well, you should understand that Toolforge environment is limited to most users needs and also to server capabilities. But do we have any option to adjust our tool's environment? Yes, we do!
Profile settings
The folder you are redirected after login/become is your home folder. It is stored in /home/username
in case of user account or /data/project/my_tool
in case of tool account. The Toolforge home folder basically works the same as the home folder on your own PC (~
or %appdata%
). There are several basic files, that define your tool environment:
.selected_editor
.profile
.gitconfig
,.subversion/config
, etc.
- .selected_editor
This file contains an information about your selected editor. To set the editor, you can use the following command:
$ select-editor
The default option is the editor nano. This is also default if you don't use the command or don't have the file created.
- .profile
This file contains a set of commands to run on every login/become. You can export
environment variables here or alias
favourite commands like:
alias ls='ls --color'
to color the ls output.
- .gitconfig, .subversion/config, etc.
If you are going to use version control system and want to set your global .gitconfig file, you can do it right here too.
Local packages
As we mentioned above, Toolforge package listing is limited to most users needs and also the package versions are limited to Debian repositories most of the time.
If you want to install your own package, you can always ask developers to add it in here. They are usually really helpful, but don't expect they will add everything you need or want. Additionally they can not install one package in multiple versions and also can not install a version, that is not in official Debian repositories.
- package system
Although you can not install a system package, you definitely can install packages from package systems of your programming language, like pip for Python, Composer for PHP, npm for JavaScript, etc. Most of those package systems are preinstalled, so if they allow users to install packages locally, like pip install --user
or npm install ~/local-folder
, you can use this option.
Mostly these package systems save the packages into the .local
folder. You can install any package from package system repositories, specific versions, everything to your needs. But of course you still can not install multiple versions of one package at once into one tool.
- project dependencies
Some programming languages or their runtimes/virtual machines, like NodeJS for JavaScript, Pub for Dart, or Pypi for Python, can work with so-called projects. Projects usually have some predefined folder structure and contain some predefined files for project description, setup, build, etc. They can also maintain their own dependencies inside the project folder. So you can actually start a new project, specify its dependencies in its description or setup file and finally run the relevant command to install the dependencies into a project subfolder.
You can create as many projects as you want and you can install as many different packages as possible. You basically create this small virtual unit in your folder system, set up its dependencies to your needs and then reach its contents when you need it.
- virtual environment
Some programming languages, like Python go even further and allow you to create so-called virtual environment. It is basically similar to projects, but emulate the command line inside the command line. Therefore you can also have several command line profiles, preferences, etc. Similarly to projects, you basically create this small virtual unit in your folder system, set up its environment to your needs and then reach its contents when you need it.
- fakechroot environment
You can go also another step further and use a fakechroot environment to install different package version, any other missing package, different Debian version or even a different Linux distribution for your tool. This is a little bit harder and also doesn't need to be stable or bug-free. You can easily install Gentoo or Debian this way and perhaps even more.
- compiling from source
Finally you can also usually download a source code of the package and compile it locally using:
$ ./configure --prefix=my_folder && make all install
Or download a precompiled Debian binary.