1) Install ubuntu

2) adduser sabin

3) install apache

sudo apt-get update

sudo apt-get install tasksel

sudo apt-get install tasksel

(apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 php5-common php5-mysql)

sudo /etc/init.d/apache2 restart

cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite

echo “ServerName localhost” | sudo tee /etc/apache2/conf.d/fqdn

sudo a2dissite default && sudo a2ensite mysite

Enable userdir

sudo a2enmod userdir
sudo vi /etc/apache2/mods-enabled/userdir.conf

<IfModule mod_userdir.c>
UserDir public_html

<Directory /home/*/public_html>
AllowOverride All
Options All MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>
</IfModule>

sudo vi /etc/apache2/mods-available/php5.conf (uncomment first 3 line)

sudo service apache2 restart

4) install python postgres git memcache nginx etc

sudo easy_install pip
sudo pip install setuptools --upgrade
pip install virtualenv
sudo apt-get install postfix
sudo apt-get install postgresql-client

sudo apt-get install git python-pip postgresql build-essential python-dev libevent-dev libpq-dev openssh-server memcached libmemcached-dev libjpeg8 libjpeg-dev libfreetype6 libfreetype6-dev nginx

    sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib
    sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib
    sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib

5) install phpmyadmin

sudo apt-get install phpmyadmin

modify /etc/phpmyadmin/config-db.php 
configure /etc/phpmyadmin/apache.conf

service apache2 restart
service mysql restart

5) install phppgadmin and configure postgressql
sudo apt-get install phppgadmin
vi /etc/phppgadmin/config.inc.php
$conf['servers'][0]['host'] = '127.0.0.1';
$conf['servers'][0]['port'] = 5432;

comment
//$conf['servers'][0]['sslmode'] = 'allow';
//$conf['extra_login_security'] = true ;
---------
edit postgres configuration
vi /etc/postgresql/9.1/main/postgresql.conf
listen_addresses = 'localhost'
or multiple ip
listen_addresses = 'localhost,192.168.0.101'
-------------------------
/etc/postgresql/9.1/main/pg_hba.conf

local all postgres md5
local all all md5
host all all 127.0.0.1/32 md5
host all all 192.168.1.0/24 md5

————————

Change password

sudo -u postgres psql
ALtER USER postgres password '123456'  or
ALTER USER postgres with encrypted password '123456'
\q
-------
or
sudo -u postgres psql postgres
\password postgres
(Ctrl+D)
-----------
sudo service postgresql restart
sudo ervice memcached restart

——————

create user directly

sudo -u postgres createuser -d -R -P sabin

create db directly
sudo -u postgres createdb -O new_username new_database_name
----------------------
connect postgres shell
psql -h localhost -U postgres
create database sabintestdb;
\l
\h 
\q
----------------------------
Creating Dumps:
//dump the roles
pg_dumpall -g -U postgres > roles.sql
Dump the schema
pg_dump -Fp -s -v -f schema.sql -U postgres
Dump the data
pg_dump -Fc -v -f data.dump -U postgres
How to restore?
psql -f roles.sql
psql -f schema.sql 
pg_restore -a -d  -Fc data.dump
-------------------------------
https://tendenci.readthedocs.org/en/latest/installation/local.html
https://github.com/tendenci/tendenci/blob/master/docs/source/installation/remote.txt

6) Prepare for tendenci to user sabin
sudo adduser sabin
su - sabin
mkdir public_html
chmod 755 public_html
cd public_html
mkdir tendenci
chmod 755 tendenci
cd tendenci
virtualenv venv
source venv/bin/activate

8) Install Tendenci (need internet)
pip install tendenci

-Once this is done, you can setup django project with the following:
create-tendenci-project

-Next, we install requirements for the project. We add tendenci videos as an example 

pip install -r requirements/dev.txt

9) (option) zip the download for other user installation
cd ..
tar -cvf tendenci.tar tendenci
cp tendenci.tar ../
cd tendenci

10) create db and user for tendenci
psql -U postgres -c "CREATE USER tendenci WITH PASSWORD '123456'";
psql -U postgres -c "CREATE DATABASE tendenci WITH OWNER tendenci;"
psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE tendenci TO tendenci;"

12 edit .env file and change DATABASE_URL='postgres://localhost/tendenci'

sudo vi .env
DATABASE_URL='postgres://tendenci:123456@localhost/tendenci'

add (optional) in .env
    LOCAL_MEMCACHED_URL = ‘127.0.0.1:11211’
    EMAIL_HOST = ‘localhost’
    EMAIL_PORT = ’25’
    HAYSTACK_SEARCH_ENGINE=’whoosh’
    SECRET_KEY=’random_16_characters’
13) Deploy Script
python deploy.py

14) If First time install some default data and our twenty-thirteen theme
python manage.py load_npo_defaults

15) Create user 
python manage.py createsuperuser

16) Run tendenci
python manage.py runserver 127.0.0.1:8000
or
python manage.py runserver

17) Create service (optional) need to login as root
sudo vi /etc/init/tendenci.conf
    description “Tendenci Upstart Script for Sabin User”
    start on runlevel [2345]
    stop on runlevel [06]
    respawn
    respawn limit 10 5
    exec /home/sabin/public_html/tendenci/.upstart.sh
sudo vi /home/sabin/public_html/tendenci/.upstart.sh
    #!/bin/bash
    set -e
    cd home/sabin/public_html/tendenci
    . venv/bin/activate
    exec gunicorn -w 2 -b 127.0.0.1:8000 conf.wsgi
    chown root:www-data /home/sabin/public_html/tendenci/.upstart.sh
    chmod u+x /home/sabin/public_html/tendenci/.upstart.sh
service tendenci start
service tendenci stop
service tendenci restart
18) Setting up nginx
sudo vi /etc/nginx/sites-available/default

server {
listen 81;
server_name 192.168.0.101;

charset utf-8;
keepalive_timeout 65;
client_max_body_size 30M;

location /static/ {
root //home/sabin/public_html/tendenci/;
access_log off;
expires 30d;
}

location /media/ {
root //home/sabin/public_html/tendenci/;
access_log off;
expires 30d;
}

location /themes/([a-zA-Z0-9\-\_]+)/media/ {
root //home/sabin/public_html/tendenci/themes/$1/media/;
access_log off;
}

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8000/;
}
}

sudo service nginx restart
http://192.168.0.101:81
and Done
====================================
====================================
Installing in another user arati db tendenci_arati:
login as root
sudo cp /home/sabin/tendenci.tar /root
sudo adduser arati
sudo cp /root/tendenci.tar /home/arati
chown -R arati:arati /home/arati/tendenci.tar

sudo su - arati
mkdir public_html
cd public_html

-----------------------
From previous achive
mv ../tendenci.tar .
tar -xvf tendenci.tar
cd tendenci
virtualenv --distribute venv
source venv/bin/activate
OR
-------------------------
From fresh
mkdir tendenci
cd tendenci
virtualenv --distribute venv
source venv/bin/activate
pip install tendenci
create-tendenci-project
pip install -r requirements/dev.txt
-----------
create db and user for tendenci_arati
psql -U postgres -c "CREATE USER tendenci_arati WITH PASSWORD '123456'";
psql -U postgres -c "CREATE DATABASE tendenci_arati WITH OWNER tendenci_arati;"
psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE tendenci_arati TO tendenci_arati;"
--------
Edit .env file and change DATABASE_URL='postgres://localhost/tendenci'

sudo vi .env
DATABASE_URL='postgres://tendenci_arati:123456@localhost/tendenci_arati'

add (optional) in .env
    LOCAL_MEMCACHED_URL = ‘127.0.0.1:11211’
    EMAIL_HOST = ‘localhost’
    EMAIL_PORT = ’25’
    HAYSTACK_SEARCH_ENGINE=’whoosh’
    SECRET_KEY=’random_16_characters’
----------
Deploy Script
python deploy.py
---------------
If First time install some default data and our twenty-thirteen theme
python manage.py load_npo_defaults
------------------
Create user 
python manage.py createsuperuser
------------------
Run tendenci in 8001 port
python manage.py runserver 127.0.0.1:8001
-------------------

if required repeat the step 17 and 18 

nginx change default to default1 
cd /etc/nginx/sites-available/
sudo cp default default1
sudo vi default1
change listen 81  to 82 and 
path /home/sabin to /home/arati and 
proxy_pass http://127.0.0.1:8000/;
to
proxy_pass http://127.0.0.1:8001/;
and link site to 
sudo ln -s /etc/nginx/sites-available/default1 /etc/nginx/sites-enabled/default1

sudo service nginx restart

http://192.168.0.101:82 in browser




                                                        

Leave a Reply