Skip to content

How to install ipfs.pics on LAMP (recommended)

Anoduck edited this page Sep 3, 2017 · 7 revisions

Dependencies

ipfs.pics is supported only on Ubuntu 16.04.

You'll need apache, php and MySQL:

sudo apt-get install apache2

sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-curl composer

sudo apt-get install mysql-server php7.0-mysql

You'll also need to install and configure ipfs. A reboot after those steps is recommended.

Setting up

If not installed, you can acquire git with:

sudo apt-get install git

Go to your web directory:

cd /var/www/

You can then clone the repo

git clone https://github.com/ipfspics/ipfspics-server.git

If you only have ipfs.pics on your server, you can remove the default folder and rename the one you just cloned:

rm html/ -R

mv ipfspics-server html

You have to activate mod_rewrite in apache:

sudo a2enmod rewrite and restart your apache server: service apache2 restart

You have to edit your apache config to allow rewrites in this directory:

sudo vim /etc/apache2/sites-available/000-default.conf

After your modifications, it should look like this:

<VirtualHost *:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/app

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

     <Directory /var/www/html/app>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
     </Directory>
</VirtualHost>

If you have multiple projects on your server, you can use multiple virtual hosts.

You need to install the dependencies with composer:

cd app

composer install

Configuring the database

In the db folder, run the following command :

cat ipfspics-DB.sql | mysql -u root -p

Then enter your database's root password, it will create the database and tables needed for your ipfs.pics server.

Running it

Make sure the ipfs daemon and the ipfs wrapper are running:

ipfs daemon

For running ipfs in production, we recommend using the supervise tool from the package daemontools.