Base: Difference between revisions

From wiki
moved sudo and aptitude to dedicated pages
Uppdate clock setup
 
Line 5: Line 5:


== 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">
$ 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
</syntaxhighlight>
 
=== NTP ===
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">
$ sudo apt purge ntpdate
$ sudo apt purge ntpdate
$ sudo systemctl enable systemd-timesyncd.service
</syntaxhighlight>Now activate systemd NTP daemon<syntaxhighlight lang="console">
Created symlink from /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service to /lib/systemd/system/systemd-timesyncd.service.
$ timedatectl set-ntp true
$ sudo systemctl start systemd-timesyncd.service
 
</syntaxhighlight>
</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.


You also need to configure timezone.<br />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.
To list the possible time zones, run<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
$ timedatectl list-timezones                                                                                                                                                                                                                                 
$ sudo dpkg-reconfigure tzdata
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
...