nextcloud

Prepare your ODROID-C2 from scratch

(1) Install the Image to your eMMC
(2) Configure the static ip address
(3) Server tweaks
(3.1) Bash (auto-) completion
(3.2) Create a new user and disable root
(3.3) Adjust your time and timezone
(3.4) ssh modifications
(3.5) optional: rename your server
(4) Update your server


(1) Install the Image to your eMMC

First download the ubuntu image from here: download. Plug your eMMC to your Desktop and search for your eMMC via

sudo -s
fdisk -l

At my environment it is called “/dev/mmcblk0“. Extract the previously downloaded image:

unxz ubuntu64-16.04-minimal-odroid-c2-20160815.img.xz

Then prepare your eMMC for acting as your server, therefore clone the Ubuntu image to your eMMC:

dd if=ubuntu64-16.04-minimal-odroid-c2-20160815.img of=/dev/mmcblk0

Wait a few minutes until the prompt will be back again and the card was written for you.

Now unplug the eMMC module from your desktop and plug the card to your ODROID-C2. In addition also plug your keyboard, your monitor, your LAN and at least the power cable.  The ODROID-C2 will reboot automatically and finally the login prompt will appear. Login as user “root” using the password “odroid“.

user: root
password: odroid

We will look for the current IP address of the server to use ssh for all further installation steps:

ifconfig

The eth0 interface will be shown first. You can find the ip address in the second row, e.g.:

inet addr:192.168.2.119

Now you can unplug the monitor and the keyboard from your ODROID-C2 and switch back to your desktop-environment. Start your preferred ssh client (e.g. Terminal or Putty) and connect to your server:

ssh root@192.168.2.119

Type in “yes” and confirm (enter) to continue and then type in the password “odroid“.

Congratulations, your server is ready to use.

(2) Configure the static ip address

Edit the network interface eth0:

cp /etc/network/interfaces.d/eth0 /etc/network/interfaces.d/eth0.bak
vi /etc/network/interfaces.d/eth0

and change the file to exemplarily:

auto eth0
iface eth0 inet static
    address 192.168.2.17
    netmask 255.255.255.0
    gateway 192.168.2.1
    dns-nameservers 192.168.2.1

Restart the network service

/etc/init.d/networking restart

or reboot your system

reboot

and login to your server using the new configured ip address:

ssh root@192.168.2.17

Once again, type in “yes” and confirm (enter) to continue and then type in the password “odroid“.

From now, your server is reachable via its static ip address called e.g.: 192.168.2.17

(3) Server tweaks

(3.1) Bash (auto-) completion

To enable bash’s auto completion install bash-completion first:

apt install bash-completion

Then edit the bash

cp /etc/bash.bashrc  /etc/bash.bashrc.bak
vi /etc/bash.bashrc

and search for ” # enable bash completion in interactive shells”. Remove the leading ‘#’ in front of the following 7 rows:

# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

Save and quit the file and reboot.

shutdown -r now

or

reboot

(3.2) Create a new user and disable root

Reconnect to your server and create a new user called “next

adduser next

and set at least the password and Name.

Grant the new user sudo privileges by running:

usermod -a -G sudo next

Logout from root shell

exit

and logon as user „next“ to your server again:

Disable root:

sudo passwd -d root

and confirm that action by typing new users (next) password.

(3.3) Adjust your time and timezone

The server is using UTC per default. Adjust your time-settings e.g. to Europe/Berlin by running:

sudo dpkg-reconfigure tzdata

and follow the wizard:

(3.4) ssh modifications

Please ensure root isn’t allowed to login using ssh anymore.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo vi /etc/ssh/sshd_config

Set “PermitRootLogin” to no:

PermitRootLogin no

Then restart the ssh service to reload the ssh settings.

sudo service ssh restart

For sure, much more security parameters are to set. Find out my example here. It is up to you to harden your server.

(3.5) optional: rename your server

Change odroid64 to e.g. cloud

sudo cp /etc/hosts /etc/hosts.bak
sudo vi /etc/hosts
127.0.0.1 localhost
127.0.0.1 cloud
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Then change /etc/hostname:

sudo cp /etc/hostname /etc/hostname.bak
sudo vi /etc/hostname

Replace odroid64 to cloud either:

cloud

Save and quit the file (:wq!) and reboot

sudo reboot

your server.

(4) Update your server

Finally update your server.

sudo apt update && sudo apt upgrade -y

Most probably your boot.ini will be changed. Confirm the upcoming message:

Run the update and upgrade command a second time and install the linux-image-c2

sudo apt install linux-image-c2 -y

and change from <Yes> to <No> in the upcoming dialogue:

Select <No> and wait until the installation completes.

Reboot your server:

sudo reboot

Yeah, done! You want to install Nextcloud? Follow this Nextcloud installation guide


Enjoy your server!

Carsten Rieger