Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Linux Setup

Marc Steiner edited this page Jun 3, 2019 · 4 revisions

Shiro is optimized exactly for the target CPU that it is built on, this means builds are not portable across machines with different distributions, library versions or CPU architectures. Therefore please execute this guide on the machine on which Shiro should run at the end.

This documentation is updated with the latest Ubuntu release 19.04. All commands prefixed with $ should be executed as non-root while commands prefixed with # should be executed as root. These are not parts of the command and should not be copied.

Requirements

The following dependencies can be installed directly from the official Ubuntu repositories:

  • gcc-8
  • g++-8
  • cmake
  • git
  • libmysqlclient20
  • default-libmysqlclient-dev
  • libboost-all-dev
  • libtcmalloc-minimal4
  • libcurl4-openssl-dev
  • libssl-dev
  • liblzma-dev
  • libmaxminddb-dev

The following dependencies are not available on the official repositories and need to be installed directly from source. A one-liner to quickly do that is provided additionally:

  • HinnantDate
     # git clone https://github.com/HowardHinnant/date.git && \
       mkdir -p /usr/include/date && \
       cp date/include/date/date.h /usr/include/date/ && \
       rm -rf date/
    
  • sqlpp11
     # git clone https://github.com/rbock/sqlpp11.git && \
       mkdir -p sqlpp11/build && \
       cd sqlpp11/build && \
       cmake -DENABLE_TESTS=Off .. && \
       make && \
       make install && \
       cd ../../ && \
       rm -rf sqlpp11/
    
  • sqlpp11-connector-mysql
     # git clone https://github.com/rbock/sqlpp11-connector-mysql.git && \
       mkdir -p sqlpp11-connector-mysql/build && \
       cd sqlpp11-connector-mysql/build && \
       cmake -DDATE_INCLUDE_DIR=/usr/include/ -DSQLPP11_INCLUDE_DIR=/usr/local/include/ -DENABLE_TESTS=Off .. && \
       make && \
       make install && \
       cd ../../ && \
       rm -rf sqlpp11-connector-mysql/
    

Compiling

In order to compile Shiro, we need to first clone the source code from this GitHub repository:

$ git clone https://github.com/Marc3842h/shiro.git
$ cd shiro

Next we need to tell CMake to generate a Makefile for us to build:

$ cmake .

Warnings such as TcMalloc-NOT-FOUND can be ignored.

For the last step, we need to compile Shiro:

$ make

After this has ended, the final Shiro binary as well as all required configuration files can be found in the bin directory.

Starting Shiro

Before starting Shiro, please have a look at configuring Shiro. Without the proper configuration, Shiro will fail to start. After you've successfully configured Shiro, it can be launched easily using the following command:

$ ./shiro

If Shiro has successfully started, you should see something similar the following output:

2019-06-03 12:11:03.299 (   2.034s) [main thread     ]               shiro.cc:117   INFO| Welcome to Shiro. Listening on http://127.0.0.1:8080/.
2019-06-03 12:11:03.300 (   2.036s) [main thread     ]               shiro.cc:118   INFO| Press CTRL + C to quit.
Clone this wiki locally