Simple time synchronization with remote ntp server

Install ntp server:

apt install -y ntp

Reading package lists... Done
Building dependency tree        
Reading state information... Done
The following additional packages will be installed:
Suggested packages:
The following NEW packages will be installed:
 libopts25 ntp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 667 kB of archives.
After this operation, 2019 kB of additional disk space will be used.
Do you want to continue? [Y/n]  
Get:1 stretch/main amd64 libopts25 amd64 1:5.18.12-3 [68.0 kB]
Get:2 stretch/main amd64 ntp amd64 1:4.2.8p10+dfsg-3+deb9u2 [599 kB]
Fetched 667 kB in 3s (181 kB/s)
Selecting previously unselected package libopts25:amd64.
(Reading database ... 42738 files and directories currently installed.)
Preparing to unpack .../libopts25_1%3a5.18.12-3_amd64.deb ...
Unpacking libopts25:amd64 (1:5.18.12-3) ...
Selecting previously unselected package ntp.
Preparing to unpack .../ntp_1%3a4.2.8p10+dfsg-3+deb9u2_amd64.deb ...
Unpacking ntp (1:4.2.8p10+dfsg-3+deb9u2) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for systemd (232-25+deb9u9) ...
Setting up libopts25:amd64 (1:5.18.12-3) ...
Processing triggers for man-db ( ...
Setting up ntp (1:4.2.8p10+dfsg-3+deb9u2) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for systemd (232-25+deb9u9) ...

Edit config file and remove pool entries and add server entries:

# You do need to talk to an NTP server or two (or three). 
# maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <>
#pool iburst
#pool iburst
#pool iburst
#pool iburst

Restart ntp service:

systemctl restart ntp

[Openstack] Create virtual machine in console

Open environment variable script

source your_admin-openrc

Create image from file

openstack image create --disk-format qcow2 --public --file ubuntu1604-image.qcow2 ubuntu1604

Create volume for virtual machine from image

openstack volume create --size 11 --image ubuntu1604 ubuntu1604-volume

If flavor not exist, crate one.

openstack flavor create --ram 8096 --vcpus 4 --public --disk 15 m1.large

Create simple network

openstack network create local
openstack subnet create local_subnet --network local --subnet-range --allocation-pool start=,end= --dns-nameserver

Create vm

Unfortunately when createin vm you have to use network id, not network name

$ openstack network list
| ID | Name | Subnets |
| e5d6ba6a-9866-4089-8125-2d2d90d1e890 | local | ae9e3f32-8e8c-483d-a957-50a0551a7fab |
openstack server create --volume ubuntu1604-volume --flavor m1.large  --nic net-id=network_uuid ubuntu1604-vm

How to edit system images (e.g. Rasbian, Openstack)

We can use guestfish a simple tool to edit images file

Open file with command

guestfish -a OrangePi_2G-IOT_Ubuntu1604_Server_GSMPPP_V1_0.img
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: 'help' for help on commands
 'man' to read the manual
 'quit' to quit the shell

><fs> run
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
><fs> list-filesystems 
/dev/sda1: ext2
/dev/sda2: ext4
><fs> mount /dev/sda2 /
><fs> edit /etc/network


PostgreSQL console

Useful Commands

Here are a few commands that can help you get an idea of your current environment:

  • \?: Get a full list of psql commands, including those not listed here.
  • \h: Get help on SQL commands. You can follow this with a specific command to get help with the syntax.
  • \q: Quit the psql program and exit to the Linux prompt.
  • \d: List available tables, views, and sequences in current database.
  • \du: List available roles
  • \dp: List access privileges
  • \dt: List tables
  • \l: List databases
  • \c: Connect to a different database. Follow this by the database name.
  • \password: Change the password for the username that follows.
  • \conninfo: Get information about the current database and connection.


W Centosie 7 wprowadzono do obsługi servisów systemd, w związku z czym z katalogu /etc/init.d znikneły skrypty do obsługi serwisów usług.

Teraz do obsługi serwisów będziemy korzystać z aplikacji service i systemctl

Aby zobaczyć listę dostępnych serwisów:

$systemctl list-unit-files

Jeśli chcemy zatrzymać/uruchomić jakąś usługę:

$service mariadb start

Aby wyświetlić informacje nt. danej usługi.

$service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service – MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since wto 2016-04-12 15:27:53 CEST; 1s ago
Process: 886 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 804 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 885 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─ 885 /bin/sh /usr/bin/mysqld_safe –basedir=/usr
└─1042 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –log-error=/var/log/mariadb/mariadb.log –pid-file=/…

kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]: The latest information about MariaDB is available at
kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]: You can find additional information about the MySQL part at:
kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]:
kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]: Support MariaDB development by buying support/new features from MariaDB
kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]: Corporation Ab. You can contact us about this at
kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]: Alternatively consider joining our community based development effort:
kwi 12 15:27:50 backup01 mariadb-prepare-db-dir[804]:
kwi 12 15:27:50 backup01 mysqld_safe[885]: 160412 15:27:50 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
kwi 12 15:27:50 backup01 mysqld_safe[885]: 160412 15:27:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
kwi 12 15:27:53 backup01 systemd[1]: Started MariaDB database server.