Skip to content

ScalityS3 on a Raspberry Pi 3 with Ubuntu Server 16.04

Christian Baun edited this page May 5, 2017 · 4 revisions

Scality S3 Server on a Raspberry Pi 3 with Ubuntu Server 16.04

The Raspberry Pi 3 single board computer from the Raspberry Pi Foundation has a 1.2 GHz quad-core ARMv8 processor, 1 GByte main memory and a 10/100 Mbps Ethernet interface.

Front of the Raspberry Pi 3 single board computer Back of the Raspberry Pi 3 single board computer

This installation tutorial explains the installation of a Raspberry Pi 3 device from scratch and the configuration of s3cmd on your computer.

This implies that you have already an installation of s3cmd on the system you want to use for the interaction with the Scality S3 storage service.

Fetch and decompress the operating system image

$ wget http://www.finnie.org/software/raspberrypi/ubuntu-rpi3/ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz
$ unxz ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz

Write the image on a local micro SD card

Check which one is the correct device! If you use an internal card reader, it is often /dev/mmcblk0, when using an external card reader, it is often /dev/sdX (replace X with the correct character).

# dd bs=1M if=ubuntu-16.04-preinstalled-server-armhf+raspi3.img of=/dev/mmcblk0 && sync 

The default login of this image is ubuntu/ubuntu. To become user root, execute sudo su.

This Ubuntu image will automatically resize the partitions on first boot and it forces the user to modify the password. This means, it is required to start first with a monitor and keyboard. Afterwards the new password has been set, a SSH server ist started per default.

Start the Raspberry Pi Computer

Insert the micro SD card into the Raspberry Pi computer, connect it with the ethernet cable and the micro USB cable for power suppy and switch on the power supply. The operating system will try to fetch network configuration by using DHCP on the Ethernet interface per default. You can now log in via SSH.

The system used with this tutorial had these characteristics:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04 LTS
Release:	16.04
Codename:	xenial
$ uname -a
Linux ubuntu 4.4.0-1009-raspi2 #10-Ubuntu SMP Tue Apr 19 19:51:04 UTC 2016 armv7l armv7l armv7l GNU/Linux

Configure the Time Zone

This is not required for running Scality S3, but it is always useful to configure the operating system properly

$ sudo dpkg-reconfigure tzdata
$ cat /etc/timezone
Europe/Berlin

Configure NTP to have the correct Time on the Raspberry Pi Computer

This is not required for running Scality S3, but it is always useful to have the correct time on a computer

$ sudo apt-get update && sudo apt-get install -y ntp ntpdate

Now the time sould be synchronized with several NTP servers.

$ ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.001
#s3.b128.net     134.249.140.162  2 u    4   64    1   35.368   -4.819   0.404
-s1.heeg.it      131.188.3.220    2 u    5   64    1   25.564    0.355   0.407
#69.10.161.7     144.111.222.81   3 u    5   64    1  197.047   -5.799   0.407
-batleth.sapient 131.188.3.220    2 u    2   64    1   34.956   -4.379   0.268
-login-vlan87.bu 185.219.2.214    2 u    4   64    1   38.803    0.894   0.457
-static.140.107. 192.53.103.103   2 u    3   64    1   35.851   -4.448   0.354
-ramses.wh2.tu-d 129.70.132.32    3 u    3   64    1   38.381    1.145   0.341
-ns.km33237.keym 131.188.3.221    2 u    1   64    1   25.662    4.352   0.167
*ntp1.rrze.uni-e .DCFp.           1 u    -   64    1   30.451    0.445   0.055
+char-ntp-pool.c .SHM.            1 u    3   64    1   34.713   -2.276   0.382
+81.2.248.189 (h 195.113.144.238  2 u    -   64    1   37.397    1.417   0.203
-golem.canonical 17.253.52.125    2 u   13   64    1   31.243    0.650   0.001

Check the time and date:

$ date -R
Mon, 01 May 2017 16:31:56 +0200

Install some packages

Some of them are not required for the installation of Scality S3, but just nice to have.

$ sudo apt-get install -y curl htop joe nmap git python build-essential     

Install Node.js and npn from here.

$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs

$ npm -version
3.10.10
$ nodejs --version
v6.10.2

1 GB of main memory is not enough to run Scality S3. In order to solve this problem, a Swap partition of at least 1 GB of size or a Swap file is required. These commands create a Swap file with 2 GB of size.

$ sudo mkdir -p /var/cache/swap
$ sudo fallocate -l 2G /var/cache/swap/swap0
$ sudo chmod 0600 /var/cache/swap/swap0
$ sudo mkswap /var/cache/swap/swap0
$ sudo swapon /var/cache/swap/swap0

Insert this line into the file /etc/fstab

/var/cache/swap/swap0    none    swap    sw      0 0

Get the source code of the Scality S3 service

$ cd ~ && git clone https://github.com/scality/S3.git
$ cd ~/S3/

Install the dependencies

$ npm install

Run Scality S3 with a file backend

$ npm start

Configure the ~/.s3cfg file to make s3cmd working with Scality S3

Just these lines need to be modified:

access_key = accessKey1
host_base = <the_ip_of_your_raspberry>:8000
host_bucket = <the_ip_of_your_raspberry>:8000
secret_key = verySecretKey1
use_https = False

Now s3cmd should work properly with the Scality S3 service.

$ s3cmd mb s3://testbucket
Bucket 's3://testbucket/' created
$ s3cmd ls
2017-05-01 18:51  s3://testbucket
$ s3cmd rb s3://testbucket
Bucket 's3://testbucket/' removed

Some important Stuff

The user access key and secret access key can be specified in this file ~/S3/conf/authdata.json.

The user access key and secret access key can also be specified via the environment variables SCALITY_ACCESS_KEY_ID and SCALITY_SECRET_ACCESS_KEY. If these are set, anything in the file authdata.json will be ignored.

In the configuration file ~/S3/config.json, the port number is specified. The default port number of Scality S3 is 8000.

The metadata will be saved in the localMetadata directory and the object data will be saved in the localData directory within the ~/S3 directory. According to the tutorial here, it is possible to specify the path of the object data and metadata directories with the environment variables S3DATAPATH and S3METADATAPATH. Example:

mkdir -m 700 $(pwd)/myFavoriteDataPath
mkdir -m 700 $(pwd)/myFavoriteMetadataPath
export S3DATAPATH="$(pwd)/myFavoriteDataPath"
export S3METADATAPATH="$(pwd)/myFavoriteMetadataPath"
npm start

Deploy Storage Services

Performance

Clone this wiki locally