I enjoy tinkering with small, energy-efficient servers. My latest toy is a LeMaker BananaPi (RaspberryPi clone, but with eSATA and gigabit ethernet).
Grab a CentOS 7 for ARM image from http://mirror.centos.org/altarch/7/isos/armhfp/, mine happens to be CentOS-Userland-7-armv7hl-Minimal-1511-BananaPi.img
Stuff that onto an SD card (mine is 16GB, but this should work even smaller) using dd commands. Insert the SD card into the BananaPi, plug the server into a MicroUSB power supply and it should boot and get an initial IP address from your DHCP server if you have one. Find that IP by checking your router; or connect keyboard, mouse, and monitor to see the console of the server (optional).
Find the device name for the SD card by TYPE, NAME, SIZE
df -h
or sudo diskutil list
On my Mac the device name is /dev/disk6s1
sudo diskutil umount /dev/disk6s1
For the DD command, switch to the raw device name and the whole disk (/dev/rdisk6) to go much faster.
sudo dd if=/Users/snolan/Downloads/CentOS-Userland-7-armv7hl-Minimal-1511-BananaPi.img of=/dev/rdisk6 bs=4m ; tput bel
Control-T to check progress of DD command – mine took about 20 minutes…
Pop the SD card into the BananaPi and power it on.
Check your router or DHCP server to see the new device’s IP address on the network.
SSH into the root@IP_of_server or use the console to login as root – either way initial password is “centos” which needs to be changed ASAP! Put your new root password into your password vault (I use KeePassX).
Let’s configure this little Server to use a static IP address now…
Find the device name of the active interface (eg: eth0):
nmcli dev status
cd /etc/sysconfig/network-scripts/
eth0 (switch to your interface/device name)
ls -l ifcfg*
vi ifcfg-
The ifcfg-XXX file should look like:
DEVICE="eth0"
HWADDR="your:mac:address:here:please"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO=static
IPADDR=192.168.subnet.ipaddr
NETMASK=255.255.255.0
Update the network file:
vi /etc/sysconfig/network
The network file should look like:
GATEWAY=192.168.subnet.router
HOSTNAME=fqdn_of_new_server
DNS1=ip_primary_nameserver
DNS2=ip_secondary_nameserver
SEARCHsearch_domain_of_your_network
Restart networking:
systemctl restart network.service
You will need stable system clock, I like to use GMT so arbitrary daylight saving stupidity does not impact my databases:
yum -y install ntp
Verify you can reach some public time servers:
grep "^server" /etc/ntp.conf
ntpdate -q 0.centos.pool.ntp.org
You want to see stratum values in low single digits (stratum 2 or stratum 3)…
ntpq -p
Make sure the servers you are looking at are stratum 2 or 3 (the “st” field in the tabular output)…
vi /etc/ntp.conf
Add the following line:
restrict 192.168.subnet.ip netmask 255.255.255.0 nomodify notrap
systemctl stop ntpd
systemctl enable ntpd
systemctl start ntpd
Test locally:
ntpdate -q 127.0.0.1
That should show a low single digit stratum number (3 or 4)…
date
That should show current UTC/GMT time…
Configure firewall to allow NTP
yum -y install system-config-firewall-tui
firewall-cmd --permanent --add-service=ntp
firewall-cmd --permanent --add-port=123/udp
firewall-cmd --reload
Test from another computer:
ntpdate -q 192.168.subnet.ip_of_server
That should show a low single digit stratum number (3 or 4)…
See which clients are using my NTP server
ntpdc -c monlist
yum install tcpdump
tcpdump udp port 123 -i any
DNS (Caching name server) and Apache/MariaDB/MediaWiki in another post…
Post a Comment