2.0 Before start

When a software package is installed, a very basic configuration is also set up, providing a very reduced or no functionality at all. For security reasons, some applications are completely disabled by default when installed. To be useful, an application must be properly configured and fine tuned.

When editing the configuration even a small mistake can be potentially harmful and usually hard to find out. Fortunately, some small precautions and a few good habits can help to prevent this.

Never ever forget to make a backup of every configuration file before start editing it! I in case of problem, will be much easier to recover the original from the backup file than try to find out what went wrong.

For example, before start editing the /etc/network/interfaces configuration file, make a quick backup:

root@server:~# cp /etc/network/interfaces /etc/network/interfaces.ori

Then edit the file:

root@server:~# nano -w /etc/network/interfaces

Now, all differences can be easily checked with the diff command:

root@server:~# diff /etc/network/interfaces.ori /etc/network/interfaces
< allow-hotplug eth0
< iface eth0 inet dhcp
> # allow-hotplug eth0
> # iface eth0 inet dhcp
> # Static IP address
> auto eth0
> iface eth0 inet static
>       address
>       netmask
>       network
>       broadcast
>       gateway

In case of trouble it is very easy to recover the original file:

root@server:~# cp /etc/network/interfaces.ori /etc/network/interfaces

The /etc/network/interfaces file has now the very initial contents.

Configuration flies are just text files, so any text editor will do the job. Historically, vi or vim (a 'Vi IMproved' version) are the Linux file editors of choice. Another option is nano. All three editors (vi, vim.tiny and nano) are installed by default in Debian 7.0 'Wheezy'.

To edit a file with vi or vim.tiny just run the command with the filename as argument:

As an example, to edit /etc/network/interfaces:

  • with vi:
root@server:~# vi /etc/network/interfaces
  • with vim.tiny:
root@server:~# vim.tiny /etc/network/interfaces
  • To use nano, add the -w option to disable wrapping of long lines:
root@server:~# nano -w /etc/network/interfaces
  • en/jessie/config/before/start.txt
  • Última modificação em: 2022-04-07 14:49
  • por