Mysql, samba, other servers

From docwiki
Jump to: navigation, search


Motivation

Besides web servers there are a lot of other server services that can be used on Linux. To much to mention them all but here just a quick overview of what is available and a little dive into mysql/mariadb and samba.

mysql/mariadb

From the free software/open source databases there is postgresql and mysql. Mysql is free software under GPL license but the company that developed it was bought by orcale. As no one trust oracle the code was forked. The free and trusted fork is mariadb which is compatible to mysql but independently developed. Often people speak of mysql when they are actually running mariadb.

If you have a mysql/maridadb server you can connect to it via network or on your localhost. Here are a few examples of how you can use it:

# mysqladmin -uroot -p create bladb
# mysqldump -uroot -p blidb >bli.dump
# cat bli.dump | mysql -uroot -p bladb
# echo "select * from blatable;" | mysql -uroot -p bladb
# mysql -uroot -p bladb
CREATE USER ’anna’@’localhost’;
SET PASSWORD FOR ’anna’@’localhost’ = PASSWORD(’geheim’);
GRANT SELECT ON bladb.* TO ’anna’@’localhost’ ;

The first mysqladmin command creates a new database named bladb. The mysqldump command would dump an existing database named blidb and store the dump into a file bli.dump. In the next line this dump is feed into the mysql client that can be used to interactively enter commands. In this case it would re-create the blidb under the name bladb. The dump contains a complete representation of a database with all commands that are needed to recreate the database. If we do not want to keep the dump file we could just use a pipe and also this could also be used to transfer a copy of the database over the network by e.g. piping through ssh. (See below).

Then we pipe a select command into that table. And the last command would create a user anna that is allowed to connect from localhost and is allowed read (select) rights on all tables in bladb.

mysqldump -uroot -p blidb | ssh anna@examle.org \
  "mysql --defaults-extra-file=/home/anna/.myopt annabackup"

the \ is just to split the long line into two lines for readability.

The dump create the dump and the ssh transmits it to the other server. If you want to avoid giving a password there this can be stored in the .myopt file.

Samba

The Samba project managed to reverse engineer the proprietary file sharing protocol from Microsoft. (Lately they have been even cooperative about that). So samba code is used to access windows file share from Linux, but Samba can also be run as a server that serves files to Windows and Mac computers.

The native file sharing protocol of unix would be NFS - which is still heavily used but mainly between servers. For file access to a diverse range of clients, the samba protocol is really useful. Here just a short example of how to use it: In /etc/samba/smb.conf but a section like this:

[musik]
comment = meine mp3sammlung als share
writable = no
locking = no
path = /opt/mp3/
public = yes
hosts allow = 192.186.0.0/255.255.0.0

Other useful Servers

asterisk
A free software telephony exchange. With dedicated hardware you can connect it to real telphone lines but it is also extremely useful as a virtual (SIP) telephony exchange. You can get cheap up and down links to the real telephony system via a lot of providers.
dhcp
your own DHCP server
ntpd
time server
ha-proxy
A load balancing high-availability proxy.
openvpn
VPN server (and client)
kerberos
central authentication
open-ldap
central authorization and directory
X11 terminal server
run your graphical application on one server with cheap and low-power dumb terminals connected. E.g. you could build graphical terminals from low end 15 year old PCs.
rsyslogd
collect your logs in a central place
zabbix, icinga, etc..
monitoring of your system
graphana
central collection of performance metrics.
pacemaker
general high availability framework
drbd
mirror data on 2 sides
ceph
distributed object store with S3 (amazon) compatibly interface