Difference between revisions of "Base"

From wiki
(Add progress to the list of base commands)
(Uppdate clock setup)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Install Base Commands ==
 
== Install Base Commands ==
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
# apt install aptitude bash-completion curl dtrx file htop iotop jnettop progress sl sudo whois
+
$ sudo apt install bash-completion curl dtrx file htop iotop jnettop progress sl whois
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Setup Clock ==
 
== Setup Clock ==
Enable [https://en.wikipedia.org/wiki/Network_Time_Protocol NTP] to keep your server clock synchronized.
+
To see the current configuration run the following command<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
+
$ timedatectl                                                                                                                                                                                                                                             
# apt purge ntpdate
+
      Local time: Sat 2017-07-01 14:38:42 UTC
# systemctl enable systemd-timesyncd.service
+
  Universal time: Sat 2017-07-01 14:38:42 UTC
Created symlink from /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service to /lib/systemd/system/systemd-timesyncd.service.
+
        RTC time: Sat 2017-07-01 14:38:42
# systemctl start systemd-timesyncd.service
+
      Time zone: UTC (UTC, +0000)
 +
Network time on: yes
 +
NTP synchronized: yes
 +
RTC in local TZ: no
 
</syntaxhighlight>
 
</syntaxhighlight>
  
You also need to configure timezone.<br />
+
=== NTP ===
For servers, it is recommended to choose the UTC timezone. That way, you avoid the time jumping in your log around [https://en.wikipedia.org/wiki/Daylight_saving_time DST] clock shifts.
+
Enable [https://en.wikipedia.org/wiki/Network_Time_Protocol NTP] to keep your computer clock synchronized.
 +
First remove the old <code>ntpdate</code> package if present
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
# dpkg-reconfigure tzdata
+
$ sudo apt purge ntpdate
 +
</syntaxhighlight>Now activate systemd NTP daemon<syntaxhighlight lang="console">
 +
$ timedatectl set-ntp true
 +
 
 +
</syntaxhighlight>If you get a message like <code>Failed to set ntp: The name org.freedesktop.PolicyKit1 was not provided by any .service files</code>, add <code>sudo</code> in front of the command.
 +
 
 +
=== Timezone ===
 +
To change the timezone, run the following command<syntaxhighlight lang="console">
 +
$ timedatectl set-timezone UTC
 +
</syntaxhighlight>If you get a message like <code>Failed to set time zone: The name org.freedesktop.PolicyKit1 was not provided by any .service files</code>, add <code>sudo</code> in front of the command.
 +
 
 +
To list the possible time zones, run<syntaxhighlight lang="console">
 +
$ timedatectl list-timezones                                                                                                                                                                                                                                 
 +
Africa/Abidjan
 +
Africa/Accra
 +
Africa/Addis_Ababa
 +
Africa/Algiers
 +
Africa/Asmara
 +
Africa/Bamako
 +
Africa/Bangui
 +
Africa/Banjul
 +
Africa/Bissau
 +
Africa/Blantyre
 +
...
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
[[Category:Linux Server]]
 
[[Category:Linux Server]]

Latest revision as of 14:42, 1 July 2017

Install Base Commands

$ sudo apt install bash-completion curl dtrx file htop iotop jnettop progress sl whois

Setup Clock

To see the current configuration run the following command

$ timedatectl                                                                                                                                                                                                                                               
      Local time: Sat 2017-07-01 14:38:42 UTC
  Universal time: Sat 2017-07-01 14:38:42 UTC
        RTC time: Sat 2017-07-01 14:38:42
       Time zone: UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

NTP

Enable NTP to keep your computer clock synchronized. First remove the old ntpdate package if present

$ sudo apt purge ntpdate

Now activate systemd NTP daemon

$ timedatectl set-ntp true

If you get a message like Failed to set ntp: The name org.freedesktop.PolicyKit1 was not provided by any .service files, add sudo in front of the command.

Timezone

To change the timezone, run the following command

$ timedatectl set-timezone UTC

If you get a message like Failed to set time zone: The name org.freedesktop.PolicyKit1 was not provided by any .service files, add sudo in front of the command. To list the possible time zones, run

$ timedatectl list-timezones                                                                                                                                                                                                                                  
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
...