Skip to content

Instantly share code, notes, and snippets.

@tbicr
Last active August 29, 2015 14:12
Show Gist options
  • Save tbicr/1ebfa13caa2ee2899d3e to your computer and use it in GitHub Desktop.
Save tbicr/1ebfa13caa2ee2899d3e to your computer and use it in GitHub Desktop.
install odb
## 0. Get ubuntu (current gite for 14.04 LTS).
## 1. Add repositories
echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/nginx-stable.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
sudo apt-get update
## 2. Install software
sudo apt-get -yq install nginx mysql-server php5-mysql php5-fpm
## 3. Configure php5-fpm
echo "cgi.fix_pathinfo=0" | sudo tee -a /etc/php5/fpm/php.ini
## 4. Configure database
#sudo mysql_install_db
#sudo mysql_secure_installation
_command="
CREATE DATABASE odb CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'odb'@'localhost' IDENTIFIED BY 'odb';
GRANT ALL ON odb.* TO 'odb'@'localhost';
"
mysql -u root -p -e "$_command"
mysql -u odb -p odb < dump.sql
## 4. Setup site
sudo mkdir -p /var/www/log
sudo chown -R www-data /var/www/log
sudo mkdir -p /var/www/odata/docroot
sudo git clone https://github.com/opendataby/website.git /var/www/odata/docroot
_connection="<?php
\$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'odb',
'username' => 'odb',
'password' => 'odb',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
"
echo "$_connection" | sudo tee /var/www/odata/docroot/sites/default/settings.local.php
sudo mkdir -p /var/www/odata/docroot/files
sudo chown -R www-data /var/www/odata
## 5. Configure nginx
sudo cp /var/www/odata/docroot/odata /etc/nginx/sites-available/default
sudo service nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment