Create mysql system db

# see also https://adrhc.go.ro/wordpress/mysql-command-line/

#CREATE SYSTEM DB (first step and mandatory before using mysql)
export SRVPATH=/ffp/opt/srv
mkdir -p $SRVPATH/mysql/innodb/
mkdir -p $SRVPATH/mysql/innodblogdir/
mkdir -p $SRVPATH/mysql/binlog/
mkdir -p $SRVPATH/mysql/log/
mkdir -p $SRVPATH/mysql/tmp/
mkdir -p $SRVPATH/mysql/data
cd /ffp
# use your my.cnf otherwise mysql won't create some innodb tables (see http://bugs.mysql.com/bug.php?id=67179&files=1):
scripts/mysql_install_db --user=root --datadir=/ffp/opt/srv/mysql/data --defaults-file=/ffp/etc/my.cnf
# if you don't have a my.cnf than run:
#scripts/mysql_install_db --user=root --datadir=/ffp/opt/srv/mysql/data
#Later (see mysql-five-tables-5.6.25.sql below) you'll create innodb missing tables.
cd ~ && /ffp/start/mysqld.sh start
mysql -p -> the default password is nothing
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'xxx321' WITH GRANT OPTION;
GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY 'xxx321' WITH GRANT OPTION;
FLUSH PRIVILEGES;
mysqladmin -u root password "xxx321"

#1. create databases and grant privileges
mysql -p
CREATE DATABASE exifweb CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE DATABASE wordpress CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE DATABASE owncloud702 CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE DATABASE ghost CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE DATABASE pydio CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON exifweb.* TO 'exifweb'@'%' IDENTIFIED BY 'exifweb' WITH GRANT OPTION;
GRANT ALL ON wordpress.* TO 'wordpress'@'%' IDENTIFIED BY 'wordpress' WITH GRANT OPTION;
GRANT ALL ON owncloud702.* TO 'owncloud702'@'%' IDENTIFIED BY 'owncloud702' WITH GRANT OPTION;
GRANT ALL ON ghost.* TO 'ghost'@'%' IDENTIFIED BY 'ghost' WITH GRANT OPTION;
GRANT ALL ON pydio.* TO 'pydio'@'%' IDENTIFIED BY 'pydio' WITH GRANT OPTION;
FLUSH PRIVILEGES;

#2. prepare sql for databases to restore
cp /i-data/md0/seagate-ext4/ProjectsNew/nsa310-config/trunk/mysql-db-design/*.sql.gz $HOME/temp/mysql-restore
cd $HOME/temp/mysql-restore
gunzip exifweb.sql.gz
gunzip wordpress.sql.gz
gunzip owncloud702.sql.gz
gunzip ghost.sql.gz
gunzip pydio.sql.gz
ls -l *.sql

#3. restore DBs
# The config variable max_allowed_packet must be larger than the imported sql script!
#see http://bugs.mysql.com/bug.php?id=67179&files=1
# Take five-tables.sql from me (it's a copy of the original):
wget https://adrhc.go.ro/public/mysql-five-tables-5.6.25.sql
# or take it from the original post:
#wget http://bugs.mysql.com/file.php?id=19725&bug_id=67179
mv 'file.php?id=19725&bug_id=67179' mysql-five-tables-5.6.25.sql
# this solves the innodb missing tables problem:
mysql -p mysql < mysql-five-tables-5.6.25.sql
# now import your databases:
mysql -u root -p exifweb < nsa310-config-trunk/mysql-db-design/exifweb.sql
mysql -u root -p wordpress < nsa310-config-trunk/mysql-db-design/wordpress.sql
mysql -u root -p owncloud702 < nsa310-config-trunk/mysql-db-design/owncloud702.sql
mysql -u root -p ghost < ghost.sql
mysql -u root -p pydio < pydio.sql
mysqlcheck -A --password=xxx321 --auto-repair

#UPGRADE DB schema
#If you use InnoDB, consider setting innodb_fast_shutdown to 0 before shutting down and upgrading your server.
/ffp/start/mysqld.sh stop
sed -i s/"innodb_fast_shutdown\s*=\s*1"/"innodb_fast_shutdown = 0"/ /ffp/etc/my.cnf
grep innodb_fast_shutdown /ffp/etc/my.cnf
/ffp/start/mysqld.sh start
/ffp/start/mysqld.sh stop
/ffp/start/mysqld.sh start
mysql_upgrade -u root -p --socket=/ffp/var/run/mysql/mysql.sock -v
/ffp/start/mysqld.sh stop
sed -i s/"innodb_fast_shutdown\s*=\s*0"/"innodb_fast_shutdown = 1"/ /ffp/etc/my.cnf
grep innodb_fast_shutdown /ffp/etc/my.cnf
/ffp/start/mysqld.sh start

Compiling Perl 5.22.0

#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.

#search http://search.cpan.org/ for modules
#see http://www.thegeekstuff.com/2008/09/how-to-install-perl-modules-manually-and-using-cpan-command/
#Installing Perl modules from CPAN (didn't work): http://perl.about.com/od/packagesmodules/qt/perlcpan.htm

#environment
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
#export LIBS="-lintl"
#export LDFLAGS="-L/ffp/lib $LIBS"
unset LIBS
export LDFLAGS="-L/ffp/lib"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"

NEW_BUILD_NAME=perl
NEW_BUILD_VER=5.22.0
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0

#building perl
cd ~/compile
wget http://www.cpan.org/src/5.0/perl-5.22.0.tar.gz
tar xvzf perl-5.22.0.tar.gz
cd ~/compile/$NEW_BUILD_NAME_AND_VER
nohup ~/x.sh ffpg &

#build configuration
./Configure -Dprefix=/ffp -Dusethreads -Duseshrplib
Build a threading Perl? [n] y
What libraries to use? [-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat]
What optimizer/debugger flag should be used? [-O2] -O2 -march=armv5te
Any additional cc flags? -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe $BUILD_FLAGS
Shall I use /ffp/bin/nm to extract C symbols from the libraries? [y] n
List of earlier versions to include in @INC? [5.20.1 5.14.2] none
Do you want to install perl as /ffp/bin/perl? [n] y
Do you wish to use dynamic loading? [y]
Any special flags to pass to cc to create a dynamically loaded library? -shared $BUILD_FLAGS -L/ffp/lib
Your host name appears to be "nsa310". Right? [y] n
Please type the (one word) name of your host: adrhc
What is your domain name? [.localdomain] .go.ro
What is your e-mail address? [root@adrhc.go.ro] ***************
What shall I put after the #! to start up perl ("none" to not use #!)? [/ffp/bin/perl5.22.0] /ffp/bin/perl
Shall I ignore gethostname() from now on? [n] y
Run make depend now? [y] n

#Manually modify config.sh:
cccdlflags='-fPIC'
ccdlflags='-Wl,-E -Wl,-rpath,/ffp/lib/perl5/5.22.0/armv5tel-linux-thread-multi/CORE'
ccflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error -I/ffp/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
usrinc='/ffp/include'
glibpth='/ffp/lib /ffp/lib/386 /usr/shlib /lib /lib/386 /usr/ccs/lib /usr/ucblib /ffp/lib '

#run after config.sh is manually modified:
sh Configure -S

#ERROR
	"can't get tcp protocol by name" for perl dist/Net-Ping/t/ tests
#SOLUTION
	#see http://forum.nas-central.org/viewtopic.php?f=249&t=16561&hilit=iana
	#see http://www.iana.org/assignments/port-numbers
	#see http://sethwklein.net/iana-etc
	#you must have already installed one of these (they are the same considering the functionality gain): 
	https://adrhc.go.ro/ffp_0.7_armv5/packages/iana-etc-2.30-arm-0.txz -> this one has more comments (compared with stripped version)
	https://adrhc.go.ro/ffp_0.7_armv5/packages/iana-etc-2.30-arm-0-stripped.txz
	http://www.inreto.de/ffp/0.7/arm/packages/iana-etc-2.30-arm-1.txz
	#then add to fun_plug.local the commands below
	cp /ffp/etc/protocols /etc/protocols
	cp /ffp/etc/services /etc/services

#ERROR
	POSIX.xs:992:18: error: 'FE_TOWARDZERO' undeclared (first use in this function)
	   case 0: return FE_TOWARDZERO;
#SOLUTION
	Comment three rows in ext/POSIX/POSIX.xs:
	/*#ifdef I_FENV
	#include <fenv.h>
	#endif*/

#make
make depend
nohup make -C . &
tail -f nohup.out
nohup /ffp/bin/make test -C . &
tail -f nohup.out

#install
rm /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz
rm -r $HOME/temp/$NEW_BUILD_NAME_AND_VER
make install DESTDIR=$HOME/temp/$NEW_BUILD_NAME_AND_VER
cd $HOME/temp/$NEW_BUILD_NAME_AND_VER
makepkg $NEW_BUILD_NAME $NEW_BUILD_VER $NEW_BUILD_NR
cp -v /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz ~/ffp_0.7_armv5/packages/
funpkg -q $NEW_BUILD_NAME
funpkg -i ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz

#Install CPAN minus module
wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7036.tar.gz
tar xvzf App-cpanminus-1.7036.tar.gz
ffpg-all
perl Makefile.PL
make
make test
make install

#In order to work CPAN minus requires:
#ln -s /ffp/etc/protocols /etc/protocols
#CPAN minus might require Mozilla's CA Bundle certificate (search /ffp/bin/cpanm for cert.pem after installation).
#download the Mozilla's CA Bundle certificate:
#wget -nv http://curl.haxx.se/ca/cacert.pem -O /ffp/etc/ssl/cert.pem

#Install cpan-outdated module (recommended way):
cpan install App::cpanoutdated
#or build yourself:
cd ~/compile
wget http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/App-cpanoutdated-0.24.tar.gz
tar xvzf App-cpanoutdated-0.24.tar.gz
cd ~/compile/App-cpanoutdated-0.24
~/x.sh ffpg
perl Makefile.PL
#installing cpanoutdated required modules
cpanm CPAN::DistnameInfo
cpanm LWP
cpanm Module::Metadata
cpanm local::lib
... and others if asked ...
make
make test
make install
#In order to learn about outdated modules run:
cpan-outdated

#Install cpanlistchanges with CPAN (recommended way):
cpan install App::cpanlistchanges
#or with CPAN minus:
cpanm App::cpanlistchanges
#If you want to see what is changed (Change-log) for CPAN module than run:
cpan-listchanges CPAN

#Building & installing Module-Build module (installed anyway when running "cpan install App::cpanoutdated").
cd ~/compile
wget http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4210.tar.gz
tar xvzf Module-Build-0.4210.tar.gz
cd Module-Build-0.4210
~/x.sh ffpg
perl Build.PL
./Build
./Build test
./Build install

#Building & installing gettext module.
#needs:
export LIBS="-lintl"
export LDFLAGS="-L/ffp/lib $LIBS"
cd ~/compile/
wget http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.05.tar.gz
tar xvzf gettext-1.05.tar.gz
cd gettext-1.05
~/x.sh ffpg
perl Makefile.PL
make
make test
make install

#When building help2man and perl has the module Locale::gettext I get the error:
#sh: error while loading shared libraries: libintl.so.8: cannot open shared object file: No such file or directory
#solved by (adding /ffp/lib to the end):
#export LD_LIBRARY_PATH=/usr/local/zy-pkgs/lib:/ffp/opt/serf-1.3.6/lib:/ffp/lib
#and also the error:
#help2man: can't get `--help' info from ./help2man
#Try `--no-discard-stderr' if option outputs to stderr
#solved by removing Locale::gettext perl module:
perl ~/tools/uninstall_perl_module.pl Locale::gettext -> only shows what files should be removed
#then remove by hand the Locale::gettext specific files

#Listing PERL modules
#original article http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/
instmodsh	-> also have capabilities to show module's files
#or
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
#or
#Perl Module Tools (https://metacpan.org/release/pmtools)
pmall - get all installed modules pmdesc descriptions
pminst - find what's installed
#or
cpan -l

#using cpanm to install App::cpanlistchanges module
cpanm App::cpanlistchanges
#using cpanm to reinstall XML::Simple module
cpanm --reinstall XML::Simple
#Shows the primary maintainers for XML::Simple module
cpan -A XML::Simple
#Show the XML::Simple module details
cpan -D XML::Simple

#upgrade a module using CPAN
#enter CPAN shell using:
cpan
#press h then ENTER for CPAN shell help
#report updates for DB_File module:
r DB_File
#report updates for CGI::Fast module:
r CGI::Fast
#upgrade CGI::Fast module:
upgrade CGI::Fast

Compiling Python 2.7.10

#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.

#Compiling Python-2.7.10
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
#export BUILD_FLAGS="$CFLAGS -I/ffp/include -I/ffp/opt/apache-2.2.29-worker/include"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
export LIBS="-lintl -lreadline -lncurses"
export LDFLAGS="-L/ffp/lib $LIBS"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"
export PATH=/ffp/sbin:/ffp/bin

NEW_BUILD_NAME=Python
NEW_BUILD_VER=2.7.10
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0

#ERROR
	Failed to build these modules:
	_curses_panel      readline
#SOLUTION (before configure)
	use -lreadline -lncurses for BUILD_FLAGS and LDFLAGS

#ERROR (make)
	export PATH=/ffp/sbin:/ffp/bin
	/ffp/bin/mkdir -p Include
	./Parser/asdl_c.py -h Include ./Parser/Python.asdl
	/ffp/bin/env: python: No such file or directory
	make: *** [Include/Python-ast.h] Error 127
#SOLUTION (apply before configure)
	#somehow python uses the existing version of python (any) to compile itself (current sources)
	#force to ignore the existing version of python when building itself:
	touch Include/Python-ast.h Python/Python-ast.c

#ERROR (test after installing)
	cd ~/temp/$NEW_BUILD_NAME_AND_VER
	ffp/bin/python
	Python 2.7.9 (default, Jan 11 2015, 18:08:14)
	[GCC 4.9.2] on linux2
	Type "help", "copyright", "credits" or "license" for more information.
	>>> help('modules')
	Please wait a moment while I gather a list of all available modules...
	ffp/bin/python: symbol '_PyErr_ReplaceException': can't resolve symbol
#SOLUTION (apply before configure)
	#See http://bugs.python.org/issue23781.
	wget http://bugs.python.org/file38697/capi_PyErr_ReplaceException.patch
	#modify capi_PyErr_ReplaceException.patch (remove a/ and b/ source path prefixes)
	#apply capi_PyErr_ReplaceException.patch accepting all defaults
	patch -p0 -i capi_PyErr_ReplaceException.patch

cd ~/compile/$NEW_BUILD_NAME_AND_VER
patch -p0 -i capi_PyErr_ReplaceException.patch
touch Include/Python-ast.h Python/Python-ast.c
#./configure --prefix=/ffp --enable-shared --enable-ipv6 --enable-big-digits --enable-unicode --with-signal-module --with-threads=/ffp --with-pth --with-doc-strings --without-pymalloc --with-fpectl --with-ensurepip=upgrade
#configure without pip; better install manually pip-6.0.6 in order to avoid CERTIFICATE_VERIFY_FAILED error when running pip
./configure --prefix=/ffp --enable-shared --enable-ipv6 --enable-big-digits --enable-unicode --with-signal-module --with-threads=/ffp --with-pth --with-doc-strings --without-pymalloc --with-fpectl

#ERROR (before make)
	./Parser/asdl_c.py -h Include ./Parser/Python.asdl
	/ram_bin/usr/bin/python: /ffp/lib/libpthread.so.0: no version information available (required by /usr/lib/libpython2.6.so.1.0)
	make: *** [Include/Python-ast.h] Segmentation fault (core dumped)
#SOLUTION
	touch Include/Python-ast.h Python/Python-ast.c

#ERROR (before make)
	Failed to build these modules:
	_curses_panel
#SOLUTION
	slacker -u br2:ncurses-5.9_20140927-arm-1.txz

touch Include/Python-ast.h Python/Python-ast.c
nohup /ffp/bin/make -C . &
tail -f nohup.out

#ERROR (after make)
	Python build finished, but the necessary bits to build these modules were not found:
	_tkinter           bsddb185           nis
	sunaudiodev
	To find the necessary bits, look in setup.py in detect_modules() for the module's name.
#SOLUTION
	This means won't build the following modules (is ok):
	_tkinter (requires X11 libraries), bsddb185 (Berkeley DB 1.85 library), nis (Interface to Sun’s NIS), sunaudiodev (Access to Sun audio hardware)

rm /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz
rm -r $HOME/temp/$NEW_BUILD_NAME_AND_VER
make install DESTDIR=$HOME/temp/$NEW_BUILD_NAME_AND_VER
cd $HOME/temp/$NEW_BUILD_NAME_AND_VER
makepkg $NEW_BUILD_NAME $NEW_BUILD_VER $NEW_BUILD_NR
cp -v /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz ~/ffp_0.7_armv5/packages/
funpkg -q $NEW_BUILD_NAME
funpkg -i ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz

#From now on RESTORE ENVIRONMENT to that specified at https://adrhc.go.ro/wordpress/common-commands-when-building:
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
unset LIBS
export LDFLAGS="-L/ffp/lib"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"

#In order to avoid CERTIFICATE_VERIFY_FAILED when using easy_install (provided by setuptools module)
#download the Mozilla's CA Bundle certificate:
wget -nv http://curl.haxx.se/ca/cacert.pem -O /ffp/etc/ssl/cert.pem

#You could use easy_install (provided by setuptools module) in order to install modules (or simply use pip).
#When using pip and required to use the "--egg" option than you better compile the module manually.
#see http://forum.nas-central.org/viewtopic.php?f=249&t=16627&p=92309#p92309

#List python modules:
python
#then, from python's shell/prompt:
help('modules')
help('setuptools') -> info about setuptools module
help('jinja2') -> info about jinja2 module (observe lower case usage)

#ERROR (la instalarea multor pachete)
	AttributeError: Distribution instance has no attribute 'include_package_data'
#SOLUTION
	Nu instala setuptools folosind:
	wget https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev

#Install setuptools-17.0
cd ~/compile
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-17.0.tar.gz#md5=fd15d24ed1e4c95e56d8c6e812f3a84f
tar xvzf setuptools-17.0.tar.gz
cd setuptools-17.0
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
python setup.py --help build
python setup.py build
python setup.py install --record module-files.txt

#Install pip-7.0.3 (requires setuptools-17.0).
#pip-7.0.3 has no CERTIFICATE_VERIFY_FAILED error
cd ~/compile
wget https://pypi.python.org/packages/source/p/pip/pip-7.0.3.tar.gz#md5=54cbf5ae000fb3af3367345f5d299d1c
tar xvzf pip-7.0.3.tar.gz
cd pip-7.0.3
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
python setup.py --help build
python setup.py build
python setup.py install --record module-files.txt

#Install SCons (better compile manually SCons because its files have non-FFP paths)
#SCons install doesn't work without --egg option.
#see also http://forum.nas-central.org/viewtopic.php?f=249&t=16627&p=92309#p92309
pip install SCons -vvv --egg --log /ffp/var/log/python/SCons.txt
#Modify the paths used by /ffp/bin/scons* files.
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons-time-2.3.0
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons-time
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons-2.3.0
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/sconsign-2.3.0
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/sconsign
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons
cd /ffp/lib/scons-2.3.0
~/x.sh ffpg

#Install Jinja2-2.7.3
cd ~/compile
wget https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
tar xvzf Jinja2-2.7.3.tar.gz
cd Jinja2-2.7.3
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
python setup.py --help build
python setup.py build
python setup.py install --record module-files.txt

#Uninstall a python module
cd ~/compile/pip-1.2.1 -> has CERTIFICATE_VERIFY_FAILED error at install
cd ~/compile/pip-1.5.6 -> has CERTIFICATE_VERIFY_FAILED error always
cd ~/compile/pip-6.0.6 -> has no CERTIFICATE_VERIFY_FAILED error
cat module-files.txt | xargs rm -rf
find /ffp/lib/python2.7/ -name "*pip*"
rm -r /ffp/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg

#Using pip:
python -m pip help
python -m pip list
#varianta cu freeze e o listare care arata si eventualele probleme ale pachetelor
python -m pip freeze
python -m pip help install
python -m pip search simplejson
python -m pip install simplejson -> nu a functionat
python -m pip install cryptography 0.6.1
python -m pip install pyOpenSSL 0.14 -vvv --log /ffp/var/log/python/pyOpenSSL-0.14.txt
python -m pip list --outdated
python -m pip install -U CherryPy -> updating CherryPy
pip install -U setuptools -v --log /ffp/var/log/python/setuptools -> updating CherryPy and recording in log
python -m pip install rst2html5 -> required by aria2
python -m pip uninstall pycurl
pip install pycurl -v --log /ffp/var/log/python/pycurl.txt
pip install PIL --allow-unverified PIL
# install yenc with allow-all-external and "--allow-unverified yenc"
pip install --allow-all-external --allow-unverified yenc yenc -v --log /ffp/var/log/python/yenc
# install from archive url
pip install -v --log /ffp/var/log/python/yenc http://www.golug.it/pub/yenc/yenc-0.4.0.tar.gz

#List module's files:
pip show -f Jinja2

#Install pycurl-7.19.5 -> required by pyLoad and easier to install using pip or easy_install (from setuptools)
cd ~/compile
wget http://pycurl.sourceforge.net/download/pycurl-7.19.5.tar.gz
tar xvzf pycurl-7.19.5.tar.gz
cd pycurl-7.19.5
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help

#ERROR0
	python: symbol 'CRYPTO_set_locking_callback': can't resolve symbol
	python: symbol 'CRYPTO_num_locks': can't resolve symbol
	python: symbol 'CRYPTO_set_id_callback': can't resolve symbol
	Traceback (most recent call last):
	File "<stdin>", line 1, in <module>
	ImportError: unknown dlopen() error
#SOLUTION0
	Nu compila cu openssl:
	python setup.py build --curl-config=/ffp/bin/curl-config --with-ssl --openssl-dir=/ffp
	Modifica setup.py:
	# self.libraries = []
	self.libraries = ["crypto"]

python setup.py build --curl-config=/ffp/bin/curl-config --with-ssl
python setup.py install --record module-files.txt
#test installation:
python
import pycurl
CTRL+D

#certifi (14.5.14)	-> required in order to avoid CERTIFICATE_VERIFY_FAILED when using easy_install (from setuptools)
#pip (6.0.6)		-> required version in order to avoid CERTIFICATE_VERIFY_FAILED error when running pip

#Requirements files are used to hold the result from pip freeze for the purpose of achieving repeatable installations. 
#In this case, your requirement file contains a pinned version of everything that was installed when pip freeze was run.
pip freeze > /ffp/opt/apache-htdocs/public/python2.7-packages.txt
pip install -r /ffp/opt/apache-htdocs/public/python2.7-packages.txt

#ecdsa module below must be corrected after installation:
cd /ffp/lib/python2.7/site-packages/ecdsa
ffpg

# pip freeze
certifi==2015.4.28
cffi==1.1.2
Cheetah==2.4.4
CherryPy==3.7.0
cryptography==0.9.3
enum34==1.0.4
Flask==0.10.1
idna==2.0
ipaddress==1.0.14
itsdangerous==0.24
Jinja2==2.8
Markdown==2.6.2
MarkupSafe==0.23
peewee==2.6.3
pyasn1==0.1.8
pycparser==2.14
pycurl==7.19.5.1
pyOpenSSL==0.15.1
requests==2.7.0
six==1.9.0
snor==0.0.8
transmissionrpc==0.11
Werkzeug==0.10.4
yenc==0.4.0