To create a user account from a shell prompt:
1. Open a shell prompt.
2. If you are not logged in as root, type the command su - and enter the root password.
3. Type useradd followed by a space and the username for the new account you are creating at the command line (for example, useradd jsmith). Press [Enter]. Often, usernames are variations on the user's name, such as jsmith for John Smith. User account names can be anything from the user's name, initials, or birthplace to something more creative.
4. Type passwd followed by a space and the username again (for example, passwd jsmith).
5. At the New password: prompt enter a password for the new user and press [Enter].
6. At the Retype new password: prompt, enter the same password to confirm your selection.
###
## Apache
###
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch20_:_The_Apache_Web_Server
seLinux, new VirtualHost
###
# New user and web sites
# % - under root
# $ - under newuser
###
% useradd newuser
% passwd newuser
% mkdir /var/www/newuser
% chown newuser /var/www/newuser
$ cd /var/www/newuser
$ mkdir site1
$ echo "test content" > site1/index.html
in httpd conf
DocumentRoot /var/www/newuser/site1
If "access denied" check: The directories (all of them) must be rwxr-xr-x (readable and executable by everyone), this apply to all the subdirectories and the parent directories in the path, the files have to be rw-r--r--
Показаны сообщения с ярлыком CentOS. Показать все сообщения
Показаны сообщения с ярлыком CentOS. Показать все сообщения
понедельник, 11 мая 2009 г.
воскресенье, 10 мая 2009 г.
Setup all needed for server CentOS
# setup-base-centos.sh
yum -y install gcc
yum -y install python-setuptools
yum -y install mc
yum -y install subversion
yum -y install python-devel # needed for:sqlite, PIL
yum -y install postgresql postgresql-server
# for ilike lower etc. on russian (see: http://habrahabr.ru/blogs/postgresql/55620/)
su postgres
initdb --locale=ru_RU.utf8 /var/lib/pgsql/data
# можем проверить командой
#psql -c "show lc_ctype"
# должно быть ru_RU.utf8
# on autostart
# http://www.cyberciti.biz/faq/howto-fedora-linux-install-postgresql-server/
chkconfig postgresql on
# start
service postgresql start
# create user for postgre
# su - postgres
# createuser -P -s -e username;
# Modify /var/lib/pgsql/data/pg_hba.conf to require password authentication for local connections:
# (for firstvds.ru hosting is /var/lib/pgsql/data/pg_hba.conf)
# Comment or remove any existing lines at the end of the file, then append this:
# local all all password
# restart service:
service postgresql restart
# create database:
createdb --encoding=UTF-8 --username=user_name --password db_name
# sqlite
yum -y install sqlite-devel
easy_install pysqlite
# setup PIL
easy_install --find-links http://www.pythonware.com/products/pil/ Imaging # if not work "from PIL import *" rename dir to "PIL"
# alt setup PIL
yum -y install python-imaging
# setup EPIL (http://fedoraproject.org/wiki/EPEL) for psycopg2
# fine howto: http://damntechnology.blogspot.com/2008/01/django-with-postgresql-on-centosrhel-5.html
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm
yum -y install postgresql-python python-psycopg2 # for use psycopg2 specify in config: postgresql_psycopg2
###
# setup django and related
###
svn co http://code.djangoproject.com/svn/django/trunk /usr/local/src/apps/django-trunk
cd /usr/local/src/apps/django-trunk
python setup.py intall
# as variant use:
# ln -s /usr/local/src/apps/django-trunk/django /usr/lib/python2.4/site-packages/django
# but this - problem with SELinux context ("ImportError: No module named django" under apache)
# See also about apache and SELinux:
# http://www.nabble.com/%22ImportError:-No-module-named-django%22-persists...-td14857086.html
# http://www.packtpub.com/article/selinux-secured-web-hosting-python-based-web-applications
svn co http://django-evolution.googlecode.com/svn/trunk/ /usr/local/src/apps/django-evolution
ln -s /usr/local/src/apps/django-evolution/django_evolution /usr/lib/python2.4/site-packages/django_evolution
easy_install django-dbtemplates
svn co http://django-filebrowser.googlecode.com/svn/trunk/filebrowser/ /usr/local/src/apps/filebrowser
ln -s /usr/local/src/apps/filebrowser /usr/lib/python2.4/site-packages/filebrowser
###
# check out project from flash
###
svn co file:///media/disk/Projects/svn/django_root/trunk /home/web-root
ln -s /home/web-root/shared/showcase /usr/lib/python2.4/site-packages/showcase
ln -s /home/web-root/shared/snippets /usr/lib/python2.4/site-packages/snippets #todo: remove snippets
###
# Set SELinux context for you django/python project directory
# if you plan create your projects in /home/sites
###
chcon -R -t httpd_user_content_t /home/sites
chcon -R -t httpd_user_content_t /home/apps
# hints
# show releases: rpm -q centos-release (rpm -q python)
# erase (uninstall) package: rpm -e package-name (rpm -e python-2.4.3-21.el5)
yum -y install gcc
yum -y install python-setuptools
yum -y install mc
yum -y install subversion
yum -y install python-devel # needed for:sqlite, PIL
yum -y install postgresql postgresql-server
# for ilike lower etc. on russian (see: http://habrahabr.ru/blogs/postgresql/55620/)
su postgres
initdb --locale=ru_RU.utf8 /var/lib/pgsql/data
# можем проверить командой
#psql -c "show lc_ctype"
# должно быть ru_RU.utf8
# on autostart
# http://www.cyberciti.biz/faq/howto-fedora-linux-install-postgresql-server/
chkconfig postgresql on
# start
service postgresql start
# create user for postgre
# su - postgres
# createuser -P -s -e username;
# Modify /var/lib/pgsql/data/pg_hba.conf to require password authentication for local connections:
# (for firstvds.ru hosting is /var/lib/pgsql/data/pg_hba.conf)
# Comment or remove any existing lines at the end of the file, then append this:
# local all all password
# restart service:
service postgresql restart
# create database:
createdb --encoding=UTF-8 --username=user_name --password db_name
# sqlite
yum -y install sqlite-devel
easy_install pysqlite
# setup PIL
easy_install --find-links http://www.pythonware.com/products/pil/ Imaging # if not work "from PIL import *" rename dir to "PIL"
# alt setup PIL
yum -y install python-imaging
# setup EPIL (http://fedoraproject.org/wiki/EPEL) for psycopg2
# fine howto: http://damntechnology.blogspot.com/2008/01/django-with-postgresql-on-centosrhel-5.html
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm
yum -y install postgresql-python python-psycopg2 # for use psycopg2 specify in config: postgresql_psycopg2
###
# setup django and related
###
svn co http://code.djangoproject.com/svn/django/trunk /usr/local/src/apps/django-trunk
cd /usr/local/src/apps/django-trunk
python setup.py intall
# as variant use:
# ln -s /usr/local/src/apps/django-trunk/django /usr/lib/python2.4/site-packages/django
# but this - problem with SELinux context ("ImportError: No module named django" under apache)
# See also about apache and SELinux:
# http://www.nabble.com/%22ImportError:-No-module-named-django%22-persists...-td14857086.html
# http://www.packtpub.com/article/selinux-secured-web-hosting-python-based-web-applications
svn co http://django-evolution.googlecode.com/svn/trunk/ /usr/local/src/apps/django-evolution
ln -s /usr/local/src/apps/django-evolution/django_evolution /usr/lib/python2.4/site-packages/django_evolution
easy_install django-dbtemplates
svn co http://django-filebrowser.googlecode.com/svn/trunk/filebrowser/ /usr/local/src/apps/filebrowser
ln -s /usr/local/src/apps/filebrowser /usr/lib/python2.4/site-packages/filebrowser
###
# check out project from flash
###
svn co file:///media/disk/Projects/svn/django_root/trunk /home/web-root
ln -s /home/web-root/shared/showcase /usr/lib/python2.4/site-packages/showcase
ln -s /home/web-root/shared/snippets /usr/lib/python2.4/site-packages/snippets #todo: remove snippets
###
# Set SELinux context for you django/python project directory
# if you plan create your projects in /home/sites
###
chcon -R -t httpd_user_content_t /home/sites
chcon -R -t httpd_user_content_t /home/apps
# hints
# show releases: rpm -q centos-release (rpm -q python)
# erase (uninstall) package: rpm -e package-name (rpm -e python-2.4.3-21.el5)
пятница, 20 марта 2009 г.
понедельник, 23 февраля 2009 г.
Steps for setup python2.5 django and satchmo on CentOS
# This post is HOW TO Install python2.5 and django and satchmo on CentOS
# You can copy this post to file and run: $ sudo sh this-post-text-file
# See also:
# http://www.perplexedlabs.com/2008/11/10/setup-python-25-mod_wsgi-and-django-10-on-centos-5-cpanel/
### Setup Python2.5 and setuptools
# Install gcc
yum -y install gcc
# Python2.5 + CentOS + ziplib, fix error: zipimport.ZipImportError: can’t decompress data; zlib not available
# for fix
# See also: http://brichotomy.com/post/49322472/python-2-5-zlib-on-centos-5
yum -y install zlib-devel
# fix: django.core.exceptions.ImproperlyConfigured: Error loading sqlite3 module: No module named _sqlite3
yum -y install sqlite-devel
# Setup python2.5.4 (before MUST setup zlib-devel). To avoid static link by python modules(e.g. mod_python) you should run configure script with "--enable-shared" option
cd /tmp
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz
tar xvfz Python-2.5.4.tgz
cd Python-2.5.4
./configure --enable-shared
make
make install
# Enable to find your dyamic link liblary
echo /usr/local/lib > /etc/ld.so.conf.d/python2.5.conf
ldconfig
# Setup easy_install (setuptools)
cd /tmp
wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg
sh setuptools-0.6c9-py2.5.egg
### Setup Django
# See also: http://docs.djangoproject.com/en/dev/topics/install/
yum -y install subversion
mkdir /home/apps
svn co http://code.djangoproject.com/svn/django/trunk/ /home/apps/django-trunk
ln -s /home/apps/django-trunk/django /usr/local/lib/python2.5/site-packages/django
ln -s /home/apps/django-trunk/django/bin/django-admin.py /usr/local/bin
### Setup Dependencies for Satchmo
# See also:http://www.satchmoproject.com/docs/svn/new_installation.html
easy_install-2.5 pycrypto
easy_install-2.5 http://code.enthought.com/enstaller/eggs/rhel/3/Reportlab-2.1.0001-py2.5.egg
easy_install-2.5 django-registration
cd /tmp
wget http://www.satchmoproject.com/snapshots/trml2pdf.tar.gz
tar xvfz trml2pdf.tar.gz
cp -R /tmp/trml2pdf/trml2pdf /usr/local/lib/python2.5/site-packages
easy_install-2.5 PyYAML
easy_install-2.5 --find-links=http://download.zope.org/distribution PILwoTk
cd /temp
wget http://banjo.assembla.com/spaces/threaded_multihost/documents/cN9MkM2jyr3Aayab7jnrAJ/download/django_threaded_multihost-1.3_0-py2.5.egg
easy_install-2.5 django_threaded_multihost-1.3_0-py2.5.egg
svn checkout http://django-app-plugins.googlecode.com/svn/trunk/ /home/apps/django-app-plugins
ln -s /home/apps/django-app-plugins/app_plugins /usr/local/lib/python2.5/site-packages/app_plugins
svn co http://sorl-thumbnail.googlecode.com/svn/trunk/sorl/ /home/apps/sorl
ln -s /home/apps/sorl /usr/local/lib/python2.5/site-packages/sorl
### Setup Satchmo
svn co svn://satchmoproject.com/satchmo/trunk /home/apps/satchmo-trunk
cd /home/apps/satchmo-trunk
python2.5 setup.py install
# setup compleeted, test correct
# first test:
# step 4 in http://www.satchmoproject.com/docs/svn/new_installation.html#installing-satchmo-into-your-path
# second test:
# cd /home/apps/satchmo-trunk/satchmo/projects/simple
# python2.5 manage.py runserver
# go to: http://localhost:8000, you can see simple shop
#
#if django running by mod_python we need upgrade mod_python for work with python2.5
#
# "apxs" is extension development framework for Apache web server. mod_python requires apxs
yum -y install httpd-devel
# mod_python; IMPORTANT: you must specify "--with-python"
cd /tmp
wget http://apache.mirrors.redwire.net/httpd/modpython/mod_python-3.3.1.tgz
tar xvfz mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure --with-python=/usr/local/bin/python2.5
make
make install
# add mod_python to Apache config and restart web server
echo LoadModule python_module /usr/lib/httpd/modules/mod_python.so\ > /etc/httpd/conf.d/python.conf
service httpd restart
# setup sqlite for python2.4
cd /tmp
wget http://oss.itsystementwicklung.de/download/pysqlite/2.5/2.5.5/pysqlite-2.5.5.tar.gz
tar xvfz pysqlite-2.5.5.tar.gz
cd pysqlite-2.5.5
python setup.py
# setup sqllite via easy_install for python2.4
uname -a
yum -y install python-devel
yum -y install sqlite-devel
cd /tmp
wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg
sh setuptools-0.6c9-py2.4.egg
easy_install pysqlite
# alternative install setuptools
yum -y install python-setuptools
# install PIL
easy_install --find-links http://www.pythonware.com/products/pil/ Imaging
setup postgre
http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html
# You can copy this post to file and run: $ sudo sh this-post-text-file
# See also:
# http://www.perplexedlabs.com/2008/11/10/setup-python-25-mod_wsgi-and-django-10-on-centos-5-cpanel/
### Setup Python2.5 and setuptools
# Install gcc
yum -y install gcc
# Python2.5 + CentOS + ziplib, fix error: zipimport.ZipImportError: can’t decompress data; zlib not available
# for fix
# See also: http://brichotomy.com/post/49322472/python-2-5-zlib-on-centos-5
yum -y install zlib-devel
# fix: django.core.exceptions.ImproperlyConfigured: Error loading sqlite3 module: No module named _sqlite3
yum -y install sqlite-devel
# Setup python2.5.4 (before MUST setup zlib-devel). To avoid static link by python modules(e.g. mod_python) you should run configure script with "--enable-shared" option
cd /tmp
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz
tar xvfz Python-2.5.4.tgz
cd Python-2.5.4
./configure --enable-shared
make
make install
# Enable to find your dyamic link liblary
echo /usr/local/lib > /etc/ld.so.conf.d/python2.5.conf
ldconfig
# Setup easy_install (setuptools)
cd /tmp
wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg
sh setuptools-0.6c9-py2.5.egg
### Setup Django
# See also: http://docs.djangoproject.com/en/dev/topics/install/
yum -y install subversion
mkdir /home/apps
svn co http://code.djangoproject.com/svn/django/trunk/ /home/apps/django-trunk
ln -s /home/apps/django-trunk/django /usr/local/lib/python2.5/site-packages/django
ln -s /home/apps/django-trunk/django/bin/django-admin.py /usr/local/bin
### Setup Dependencies for Satchmo
# See also:http://www.satchmoproject.com/docs/svn/new_installation.html
easy_install-2.5 pycrypto
easy_install-2.5 http://code.enthought.com/enstaller/eggs/rhel/3/Reportlab-2.1.0001-py2.5.egg
easy_install-2.5 django-registration
cd /tmp
wget http://www.satchmoproject.com/snapshots/trml2pdf.tar.gz
tar xvfz trml2pdf.tar.gz
cp -R /tmp/trml2pdf/trml2pdf /usr/local/lib/python2.5/site-packages
easy_install-2.5 PyYAML
easy_install-2.5 --find-links=http://download.zope.org/distribution PILwoTk
cd /temp
wget http://banjo.assembla.com/spaces/threaded_multihost/documents/cN9MkM2jyr3Aayab7jnrAJ/download/django_threaded_multihost-1.3_0-py2.5.egg
easy_install-2.5 django_threaded_multihost-1.3_0-py2.5.egg
svn checkout http://django-app-plugins.googlecode.com/svn/trunk/ /home/apps/django-app-plugins
ln -s /home/apps/django-app-plugins/app_plugins /usr/local/lib/python2.5/site-packages/app_plugins
svn co http://sorl-thumbnail.googlecode.com/svn/trunk/sorl/ /home/apps/sorl
ln -s /home/apps/sorl /usr/local/lib/python2.5/site-packages/sorl
### Setup Satchmo
svn co svn://satchmoproject.com/satchmo/trunk /home/apps/satchmo-trunk
cd /home/apps/satchmo-trunk
python2.5 setup.py install
# setup compleeted, test correct
# first test:
# step 4 in http://www.satchmoproject.com/docs/svn/new_installation.html#installing-satchmo-into-your-path
# second test:
# cd /home/apps/satchmo-trunk/satchmo/projects/simple
# python2.5 manage.py runserver
# go to: http://localhost:8000, you can see simple shop
#
#if django running by mod_python we need upgrade mod_python for work with python2.5
#
# "apxs" is extension development framework for Apache web server. mod_python requires apxs
yum -y install httpd-devel
# mod_python; IMPORTANT: you must specify "--with-python"
cd /tmp
wget http://apache.mirrors.redwire.net/httpd/modpython/mod_python-3.3.1.tgz
tar xvfz mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure --with-python=/usr/local/bin/python2.5
make
make install
# add mod_python to Apache config and restart web server
echo LoadModule python_module /usr/lib/httpd/modules/mod_python.so\ > /etc/httpd/conf.d/python.conf
service httpd restart
# setup sqlite for python2.4
cd /tmp
wget http://oss.itsystementwicklung.de/download/pysqlite/2.5/2.5.5/pysqlite-2.5.5.tar.gz
tar xvfz pysqlite-2.5.5.tar.gz
cd pysqlite-2.5.5
python setup.py
# setup sqllite via easy_install for python2.4
uname -a
yum -y install python-devel
yum -y install sqlite-devel
cd /tmp
wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg
sh setuptools-0.6c9-py2.4.egg
easy_install pysqlite
# alternative install setuptools
yum -y install python-setuptools
# install PIL
easy_install --find-links http://www.pythonware.com/products/pil/ Imaging
setup postgre
http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html
Подписаться на:
Сообщения (Atom)