Ferramentas de Usuário

Ferramentas de Site


en:wheezy:config:before:start

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.

Backup everything

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
9,10c9,20
< allow-hotplug eth0
< iface eth0 inet dhcp
---
> #allow-hotplug eth0
> #iface eth0 inet dhcp
>
> # Static IP address
> auto eth0
> iface eth0 inet static
>       address 192.168.1.100
>       netmask 255.255.255.0
>       network 192.168.1.0
>       broadcast 192.168.1.255
>       gateway 192.168.1.1

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.

What text editor to use?

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

References

en/wheezy/config/before/start.txt · Última modificação em: 2024-02-15 01:05 por 127.0.0.1