LFS on Ubuntu(7) 一時的環境の構築 (Findutils-4.4

LFSユーザになる

yoshiring@the-world:~$ su lfs
パスワード:
lfs@the-world:/home/yoshiring$ echo $LFS
/mnt/lfs
$ cd $LFS/sources

Findutils のインストール

$ tar zxvf findutils-4.4.2.tar.gz
$ cd findutils-4.4.2
$ ./configure --prefix=/tools
$ make
$ make install

Gawk のインストール

$ tar jxf gawk-3.1.7.tar.bz2
$ cd gawk-3.1.7
$ ./configure --prefix=/tools
$ make
$ make install

Gettext-0.17 のインストール

$ tar zxvf gettext-0.17.tar.gz
cd gettext-0.17/gettext-tools
$ ./configure --prefix=/tools --disable-shared
$ make -C gnulib-lib
$ make -C src msgfmt
$ cp -v src/msgfmt /tools/bin

Grep のインストール

$ tar jxf grep-2.5.4.tar.bz2
$ cd grep-2.5.4
$ ./configure --prefix=/tools \
--disable-perl-regexp \
--without-included-regex
$ make
$ make install

Gzip のインストール

$ tar zxvf gzip-1.4.tar.gz
$ cd gzip-1.4
$ ./configure --prefix=/tools
$ make
$ make install

M4-1.4.13

Make-3.81

Patch-2.6.1

Perl-5.10.1

Sed-4.2.1

Tar-1.22

Texinfo-4.13a

ストリップ

必須ではない為、省略

所有者の変更

# vi .bashrc
LFS=/mnt/lfs
# source .bashrc
# chown -R root:root $LFS/tools

Ubuntu8.04 で Django1.2.1 を使う為に色々と(3)

PostgreSQLの初期化

Ubuntu で PostgreSQL を使ってみよう(続編)
PostgreSQL Ubuntuにインストール

//Ubuntuでは自動的に初期化されている?

PostgreSQLのデータベーステンプレートを作成

$ su - postgres
$ createdb -E UTF8 template_postgis
$ createlang -d template_postgis plpgsql
$ psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
$ psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
$ psql -d template_postgis
template_postgis=# GRANT ALL ON geometry_columns TO PUBLIC;
template_postgis=# GRANT ALL ON spatial_ref_sys TO PUBLIC;

Djangoアプリケーションで利用するデータベースの作成

$ createuser djangobook
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
$ createdb -U postgres -O djangobook -T template_postgis manoush

Djangoでsyncdb

Postgresql pg_hba.conf設定

$ cd /path/to/project
$ python manage.py syncdb
 _cursor
    self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: FATAL:  Ident authentication failed for user "djangobook"
//エラー発生

//PostgreSQLの設定ファイルを編集
# vi /etc/postgresql/8.3/main/postgresql.conf
---#listen_addresses = ‘localhost’
+++listen_addresses = ‘*'
# vi pg_hba.conf
記述要調査
# /etc/init.d/postgresql-8.3 restart

Ubuntu8.04 で Django1.2.1 を使う為に色々と(1)

Ubuntuのバージョン確認

$ cat /etc/lsb-release
DISTRIB_RELEASE=8.04

PIL用ライブラリzlib/zlib-develのインストール

//yumコマンドを実行すると以下のエラーが発生
$ yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named cElementTree

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)]

If you cannot solve this problem yourself, please send this
message to <yum@lists.linux.duke.edu>.

//エラーメッセージに従いcElementTreeをインストール
$ cd ~/download wget http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz
$ tar zxvf cElementTree-1.0.5-20051216.tar.gz
$ cd cElementTree-1.0.5-20051216
$ sudo python setup.py install

//zlibをインストールすると警告が…
# yum install zlib
Warning, could not load sqlite, falling back to pickle
Setting up Install Process
Setting up repositories
No Repositories Available to Set Up
Reading repository metadata in from local files
Parsing package install arguments
No Match for argument: zlib
Nothing to do

以下のサイトを参考にし、pysqliteが入っていないのが問題かと仮説を立てる

pysqliteのインストール

$ wget http://pysqlite.googlecode.com/files/pysqlite-2.6.0.tar.gz
$ tar zxvf pysqlite-2.6.0.tar.gz
$ cd pysqlite-2.6.0
# vi setup.cfg
以下の様に修正
include_dirs=/usr/include
library_dirs=/usr/lib
# python setup.py build

//エラー発生
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -DSQLITE_OMIT_LOAD_EXTENSION=1 -I/usr/include -I/usr/include/python2.5 -c src/module.c -o build/temp.linux-i686-2.5/src/module.o
In file included from src/module.c:24:
src/connection.h:33:21: error: sqlite3.h: No such file or directory
In file included from src/module.c:24:
src/connection.h:38: error: expected specifier-qualifier-list before 'sqlite3'
In file included from src/module.c:25:
src/statement.h:37: error: expected specifier-qualifier-list before 'sqlite3'
src/module.c: In function 'module_complete':
src/module.c:99: warning: implicit declaration of function 'sqlite3_complete'
src/module.c: At top level:
src/module.c:265: error: 'SQLITE_OK' undeclared here (not in a function)
src/module.c:266: error: 'SQLITE_DENY' undeclared here (not in a function)
src/module.c:267: error: 'SQLITE_IGNORE' undeclared here (not in a function)
src/module.c:268: error: 'SQLITE_CREATE_INDEX' undeclared here (not in a function)
src/module.c:269: error: 'SQLITE_CREATE_TABLE' undeclared here (not in a function)
src/module.c:270: error: 'SQLITE_CREATE_TEMP_INDEX' undeclared here (not in a function)
src/module.c:271: error: 'SQLITE_CREATE_TEMP_TABLE' undeclared here (not in a function)
src/module.c:272: error: 'SQLITE_CREATE_TEMP_TRIGGER' undeclared here (not in a function)
src/module.c:273: error: 'SQLITE_CREATE_TEMP_VIEW' undeclared here (not in a function)
src/module.c:274: error: 'SQLITE_CREATE_TRIGGER' undeclared here (not in a function)
src/module.c:275: error: 'SQLITE_CREATE_VIEW' undeclared here (not in a function)
src/module.c:276: error: 'SQLITE_DELETE' undeclared here (not in a function)
src/module.c:277: error: 'SQLITE_DROP_INDEX' undeclared here (not in a function)
src/module.c:278: error: 'SQLITE_DROP_TABLE' undeclared here (not in a function)
src/module.c:279: error: 'SQLITE_DROP_TEMP_INDEX' undeclared here (not in a function)
src/module.c:280: error: 'SQLITE_DROP_TEMP_TABLE' undeclared here (not in a function)
src/module.c:281: error: 'SQLITE_DROP_TEMP_TRIGGER' undeclared here (not in a function)
src/module.c:282: error: 'SQLITE_DROP_TEMP_VIEW' undeclared here (not in a function)
src/module.c:283: error: 'SQLITE_DROP_TRIGGER' undeclared here (not in a function)
src/module.c:284: error: 'SQLITE_DROP_VIEW' undeclared here (not in a function)
src/module.c:285: error: 'SQLITE_INSERT' undeclared here (not in a function)
src/module.c:286: error: 'SQLITE_PRAGMA' undeclared here (not in a function)
src/module.c:287: error: 'SQLITE_READ' undeclared here (not in a function)
src/module.c:288: error: 'SQLITE_SELECT' undeclared here (not in a function)
src/module.c:289: error: 'SQLITE_TRANSACTION' undeclared here (not in a function)
src/module.c:290: error: 'SQLITE_UPDATE' undeclared here (not in a function)
src/module.c:291: error: 'SQLITE_ATTACH' undeclared here (not in a function)
src/module.c:292: error: 'SQLITE_DETACH' undeclared here (not in a function)
src/module.c: In function 'init_sqlite':
src/module.c:419: warning: implicit declaration of function 'sqlite3_libversion'
src/module.c:419: warning: passing argument 1 of 'PyString_FromString' makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1

sqlite3がpython2.5と同一path上にインストールされている必要があるとの事
はまったところ/pysqliteのインストール

sqlite3の再インストール

//インストールディレクトリの確認
# find / -name "sqlite"
/usr/bin/sqlite3

//アンインストール
# rm -rf sqlite*

//sqlite3のインストール
$ wget http://www.sqlite.org/sqlite-3.5.9.tar.gz
$ tar xvzf sqlite-3.5.9.tar.gz
$ cd sqlite-3.5.9
# ./configure --prefix=/usr/lib     """pythonの入ったディレクトリを指定"""
# make
# make install
# make clean

//インストール確認
$ which sqlite
$ which sqlite3

//入っていない…?
# find / -regex "*sqlite*"

//apt-getでインストール
# apt-get install sqlite3
Reading package lists... Done
Building dependency tree
Reading state information... Done
sqlite3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.

//バージョン管理がおかしくなったか?
// Synapticを起動してみると次のエラーが表示される
W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/main Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_main_binary-i386_Packages)

W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/universe Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_universe_binary-i386_Packages)

//アンインストール
# apt-get remove sqlite3
Removing sqlite3 ...
W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/main Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_main_binary-i386_Packages)
W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/universe Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_universe_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems
# apt-get update

//インストール
# apt-get install sqlite3
$ sqlite3
SQLite version 3.4.2
Enter ".help" for instructions
sqlite>
// ようやく元に戻った…が

libsqlite3-devが必要だったのか
http://www.linuxquestions.org/questions/linux-software-2/error-sqlite3-h-no-such-file-or-directory-771732/

pysqliteを今一度インストール

//libsqlite3-devのインストール
# apt-get install libsqlite3-dev
$ cd pysqlite-2.6.0
# vi setup.cfg
以下の様に修正
include_dirs=/usr/include
library_dirs=/usr/lib
# python setup.py build
# python setup.py install

//インストール確認
# python
>>> import sys
>>> sys.path.append('/usr/lib/python2.5/site-packages/')
>>> import pysqlite2
//エラーが出なければOK

JavaScriptライブラリjQueryの使用

//ダウンロード
$ wget http://code.jquery.com/jquery-1.4.2.min.js
//Djangoプロジェクト直下に配置
$ mv jquery-1.4.2.min.js ~/path/to/project/templates/static/js/

//JGrowlプラグインも利用
$ wget http://plugins.jquery.com/files/jGrowl-1.2.4.zip
$ unzip jGrowl-1.2.4.zip
$ mv jquery.jgrowl.css ~/path/to/project/templates/static/styles/
$ mv jquery.jgrowl.js ~/w*/manoush/templates/static/js/

Ubuntu8.04 で Django1.2.1 を使う為に色々と(2)

PostgreSQLのインストール

# useradd postgres
# apt-get install postgresql-8.4

psycopg2のインストール

(Psycopg) easy_install doesn't work
Installing Django with PostgreSQL on Ubuntu

//最新のソースコードをpsycopg2のサイトからダウンロード
$ tar zxvf psycopg2-2.0.14.tar.gz
$ cd psycopg2-2.0.14
$ export PATH=$PATH:/usr/local/pgsql/bin
# python setup.py build
In file included from psycopg/psycopgmodule.c:32:
./psycopg/psycopg.h:31:22: error: libpq-fe.h: No such file or directory
//エラー発生

//postgresql-devのインストール
# apt-get install postgresql-dev
//エラー発生

//上手くいかないのでapt-getからインストール
# apt-get install python-psycopg2

GEOSのインストール

$ wget http://download.osgeo.org/geos/geos-3.0.0.tar.bz2
$ tar xjf geos-3.0.0.tar.bz2
$ cd geos-3.0.0
$ ./configure
$ make
$ sudo make install

PROJのインストール

$ wget http://download.osgeo.org/proj/proj-4.6.0.tar.gz
$ wget ftp://ftp.remotesensing.org/proj/proj-datumgrid-1.3.tar.gz
--09:20:38--  ftp://ftp.remotesensing.org/proj/proj-datumgrid-1.3.tar.gz
$ tar zxvf proj-4.6.0.tar.gz
$ cd proj-4.6.0/nad
$ tar zxvf ../../proj-datumgrid-1.3.tar.gz
$ cd ../
$ ./configure
$ make
$ sudo make install

PostGISのインストール

Using PostgreSQL on Debian and Ubuntu
Can't find pg_config? PostgreSQL problem
PostGISのインストール

$ wget http://postgis.refractions.net/download/postgis-1.3.3.tar.gz
$ tar zxvf postgis-1.3.3.tar.gz

//とその前にpostgresql-contrib-8.4が必要な模様
$ sudo apt-get install postgresql-contrib-8.4

//改めてPostGIS1.3.1のインストール
$ cd /usr/share/postgresql/8.4/contrib
$ sudo mv ~/download/postgis-1.3.3 /usr/share/postgresql/8.4/contrib/.
$ cd postgis-1.3.3

//とその前にlibpq-devが必要な模様
$ sudo apt-get install libpq-dev

//改めてPostGIS1.3.1のインストール
$ cd /usr/share/postgresql/8.4/contrib/postgis-1.3.3
$ ./configure --with-pgsql=/usr/bin/pg_config
//エラー発生

//インストールに際してさらにパッケージが必要か
$ sudo apt-get install libpq-dev
$ sudo apt-get install postgresql-server-dev-8.4
$ sudo apt-get install flex
$ sudo apt-get install xsltproc

//改めてPostGIS1.3.1のインストール
# adduser postgres admin
# su - postgres
$ cd /usr/share/postgresql/8.4/contrib/postgis-1.3.3
$ sudo ./configure --with-pgsql=/user/bin/pg_config
$ make
//エラー発生
make[1]: *** [lwgeom_estimate.o] エラー 1
make[1]: ディレクトリ `/usr/share/postgresql/8.4/contrib/postgis-1.3.3/lwgeom'  から出ます
make: *** [liblwgeom] エラー 2

//標準パッケージのPostGISはPostgreSQL 8.4をサポートしていないとの事
# apt-get update
# apt-cache pkgnames | grep postgresql-\.*-postgis
postgresql-8.3-postgis
postgresql-8.2-postgis

//Postgresql-8.4を削除して8.3をインストールする
# apt-get remove postgresql-8.4
# apt-get install postgresql-8.3
# apt-get remove libpq-dev
# apt-get autoremove
# rm -rf /usr/share/postgresql/8.4/contrib
# apt-get install postgresql-contrib-8.3

//postgisのインストール
# apt-get install postgresql-8.3-postgis
//SQLサーバはそのまま標準パッケージをインストール
# apt-get install postgresql
//GEOS(Geometry Engine Open Source)Proj.4(Cartographic Projections Library)をインストール
# apt-get install libgeos-dev
# apt-get install proj

// 必要パッケージのインストール
# apt-get install libpq-dev
# apt-get install postgresql-server-dev-8.4
# apt-get install flex
# apt-get install xsltproc
# su - postgres

//改めてPostGIS1.3.1のインストール
$ tar xf postgis-1.3.3.tar.gz
$ sudo mv ~/download/postgis-1.3.3 /usr/share/postgresql/8.3/contrib/.
$ su - postgres
$ cd /usr/share/postgresql/8.3/contrib/postgis-1.3.3
$ sudo ./configure --with-pgsql=/usr/bin/pg_config
$ make
//さっきと同じエラー発生
make[1]: *** [lwgeom_estimate.o] エラー 1
make[1]: ディレクトリ `/usr/share/postgresql/8.4/contrib/postgis-1.3.3/lwgeom'  から出ます
make: *** [liblwgeom] エラー 2
$ sudo rm -rf /usr/share/postgresql/8.3/contrib/postgis-1.3.3

//postgis-1.4.1を入れるか
$ wget http://postgis.refractions.net/download/postgis-1.4.1.tar.gz
$ tar xf postgis-1.4.1.tar.gz
$ cd postgis-1.4.1.tar.gz
$ ./configure
$ make
$ sudo make install
$ make clean

お名前.comのVPS01でDjango

yumのインストール

$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/m2crypto-0.16-6.el5.6.x86_64.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/python-sqlite-1.1.7-1.2.1.x86_64.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/python-urlgrabber-3.1.0-5.el5.noarch.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/ceentos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

# rpm -ivh m2crypto-0.16-6.el5.6.x86_64.rpm
# rpm -ivh python-elementtree-1.2.6-5.x86_64.rpm
# rpm -ivh yum-metadata-parser-1.1.2-3.el5. centos.x86_64.rpm
# rpm -ivh python-urlgrabber-3.1.0-5.el5.noarch.rpm
# rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm
# rpm -ivh python-sqlite-1.1.7-1.2.1.x86_64.rpm
# rpm --import http://mirror.centos.org/centos-5/5.3/o s/i386/RPM-GPG-KEY-CentOS-5
# rpm -ivh yum-3.2.22-26.el5.centos.noarch.rpm yum-fasttestmirror-1.1.16-14.el5.centos.noarch.rpm

Python2.5とDjangoのインストール

wget http://python.org/ftp/python/2.5.2/Python-2.5.2 .tgz
tar xvfz Python-2.5.2.tgz
cd Python-2.5.2
./configure --prefix=/opt/python2.5 --with-threa ds --enable-shared
vi ./Modules/Setup
make
make install
vi opt-python2.5.conf
/sbin/ldconfig
ln -s /opt/python2.5/bin/python /usr/bin/python2.5
wget http://pypi.python.org/packages/2.5/s/setuptool s/setuptools-0.6c9-py2.5.egg
sh setuptools-0.6c11-py2.5.egg --prefix=/opt/python2 .5
curl -O http://peak.telecommunity.com/dist/ez_se tup.py
easy_install Django

パス周り

$ vi .bash_profile
--- PATH=$PATH:$HOME/bin
+++ PATH=$PATH:$HOME/bin:/opt/python2.5/bin/
$ vi .bashrc
+++ alias python='python2.5'
$ source ~/.bash_profile
$ source ~/.bashrc

Djangoのバージョン確認

django-admin.py --version
1.2.1

デプロイ

# httpd -v
Server version: Apache/2.2.3
Server built:   Oct 14 2009 20:27:59
cd etc
$ find . -name httpd.conf -print
./httpd/conf/httpd.conf

//mod_pythonのインストール
# yum -y install httpd-devel
# cd DOWNLOAD_DIR
# wget http://ftp.kddilabs.jp/infosystems/apache/httpd/modpython/mod_python-3.3.1.tgz
# tar xfz mod_python-3.3.1.tgz
# cd mod_python-3.3.1
# ./configure --with-python=/opt/python2.5/bin/python2.5 --with-apxs=/usr/sbin/apxs
# make
# make install

//Django+mod_python
# chown stamp109.com /var/www/vhosts/stamp109.com/httpdocs
$ cd /var/www/vhosts/stamp109.com/httpdocs
$ django-admin.py startapp polls #Djangoチュートリアルアプリ作成
# vi /etc/httpd/conf.d/python.conf
LoadModule python_module modules/mod_python.so
<Location "/stamprally/">
    SetHandler python-program
    PythonPath "['/var/www/vhosts/mydomain/httpdocs']+sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv PYTHON_EGG_CACHE /var/www/vhosts/mydomain/httpdocs/stamprally/.python-eggs 
    SetEnv DJANGO_SETTINGS_MODULE stamprally.settings
    PythonDebug On
</Location>

# vi /etc/httpd/conf/httpd.conf
<Location "/stamprally/">
    SetHandler python-program
    PythonPath "['/var/www/html/']+sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE stamprally.settings
    PythonOption django.root /stamprally
    PythonDebug On
    PythonPath "['/var/www/vhosts/mydomain/httpdocs'] + sys.path"
</Location>
# /sbin/service httpd configtest
# /sbin/service httpd restart

画像ライブラリPILのインストール

# wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
# tar zxvf Imaging-1.1.7.tar.gz
# cd Imaging-1.1.7
# /opt/python2.5/bin/python setup.py build
# /opt/python2.5/bin/python setup.py install
//必要なライブラリの追加
# yum install libjpeg
# yum install libjpeg-devel
# yum install zlib       
# yum install zlib-devel 

デプロイの続き

ここでブラウザからアクセスするとmod_pythonのエラー
ImportError: No module named django.core.handlers.modpython

シンボリックリンクを作成してみる
# ln -s django /opt/python2.5/lib/python2.5/site-packages

エラーが変わった
SystemError: NULL result without error in PyObject_Call

# chmod a+x /var/www/vhosts/mydomain/httpdocs/

pysqliteのインストール

//pysqliteのインストール
# /opt/python2.5/bin/easy_install pysqlite
エラー発生:command 'gcc' failed with exit status

//gccのインストール
# yum install gcc

//再度pysqliteのインストール
# /opt/python2.5/bin/easy_install pysqlite
エラー発生:/usr/bin/ld: cannot find -lpython2.5

//ソースからpysqliteをインストール
# wget http://pysqlite.googlecode.com/files/pysqlite-2.6.0.tar.gz
# tar xvzf pysqlite-2.6.0.tar.gz
# cd pysqlite-2.6.0
# vi setup.cfg
以下の様に修正
include_dirs=/opt/python2.5
librarly_dirs=/opt/python2.5/lib
# /opt/python2.5/bin/python setup.py build
# /opt/python2.5/bin/python setup.py install --prefix=/opt/python2.5

//インストール完了の確認
# /opt/python2.5/bin/python
>>> import sys
>>> sys.path.append('/opt/python2.5/lib/python2.5/site-packages/')
>>> import pysqlite2
Apacheを再起動してブラウザからアクセスするとエラーが変わった
DatabaseError: unable to open database file

データベースファイルの親ディレクトリのパーミッションを変更すると、画面にアクセスできました☆
http://www.mail-archive.com/django-users@googlegroups.com/msg16740.html

Subversion on Ubuntu

Subversion のインストール

sudo apt-get install subversion subversion-tools libapache2-svn

Subversion の設定

sudo vi /etc/apache2/mods-enabled/dav_svn.conf
以下のように編集
<Location /svn>
  DAV svn
  SVNParentPath /home/username/svn
</Location>

Apache の再起動

sudo /etc/init.d/apache2 restart

ローカルでバージョン管理のテスト

mkdir ~/svn

//レポジトリの作成
svnadmin create ~/svn/test

//一時作業フォルダの作成
mkdir ~/work
mkdir ~/work/source
echo "Hello World" > ~/work/source/test.txt

//インポート
svn import ~/work/source/ file:///home/username/svn/test/ -m "import test"
※インターネット経由でバージョン管理する場合
:| ps aux | grep apache2
:| sudo chown -R www-data.www-data ~/svn/test
:| svn import ~/work/source/ http://localhost/svn/test/ -m "import test"

//チェックアウト
mkdir ~/work/checkout
svn checkout file:///home/username/svn/test ~/work/checkout

//編集してコミット
$ echo "Goodby World" > ~/work/checkout/test.txt
$ svn diff
Index: test.txt
===================================================================
--- test.txt    (revision 1)
+++ test.txt    (working copy)
@@ -1 +1 @@
-Hello World
+Goodby World

$ svn add ~/work/checkout/test.txt
$ svn commit -m "Change test.txt"
Sending        test.txt
Transmitting file data .
Committed revision 2.

//新しいファイルを追加

$ svn add ~/work/checkout/hoge.txt
$ svn commit -m "Add hoge.txt"

CentOS インストール & 初期設定 & Python 開発環境構築メモ

Win7 のゲスト OS として、CentOS5 を VirtualBoxにインストールし、PythonDjango 開発環境を作成するまでのメモ。


CentOSVirtualBox にインストール

ディスプレイ設定を ACER ASPIRE 1410 に合わせる

# system-config-display
ディスプレイ設定 > ハードウェアタブ > モニタータイプの設定 > Generic LCD Display > LCD Panel 1360x768 > OK > モニター設定タブ > 解像度1024x768 > OK
# shutdown -r now
※横は 1366 まで拡げたい、縦はもう少し縮めたいが…

サーバのホスト名を変更(←要調査)

# vi /etc/hosts
192.168.56.101 myhost.domain.jp myhost
127.0.0.1 localhost.localdomain localhost

# vi /etc/sysconfig/network
HOSTNAME=myhost.domain.jp

# vi /etc/hosts.allow
ALL : 127.0.0.1
sshd : ALL

# /etc/rc.d/init.d/network restart

SSH の設定

Apache の起動と自動起動設定

# httpd -v
Server version: Apache/2.2.3
# /etc/rc.d/init.d/httpd start
# chkconfig httpd on

httpd-devel のインストール

# yum -y install httpd-devel

Python のバージョン確認

$ python -V
Python 2.4.3

GCC のインストール

# yum -y install gcc

mod_python のインストール

http://httpd.apache.org/modules/python-download.cgi から mod_python-3.3.1.tgz をダウンロード
$ cd /tmp
$ tar xfz mod_python-3.3.1.tgz
$ cd /tmp/mod_python-3.3.1
$ ./configure --with-apxs=/usr/sbin/apxs
$ make // ここでエラーが発生(←要調査)

Django のインストール

http://www.djangoproject.com/download/ から Django-1.1.1.tar.gz. をダウンロード
/tmp 配下に展開
cd /tmp/Django-1.1.1
# python setup.py install

eclipse のインストール

http://www.eclipse.org/downloads/ から Eclipse Classic 3.5.2 (163 MB) をダウンロード
eclipse-SDK-3.5.2-linux-gtk-x86_64.tar.gz を /home/yoshiring 配下に展開
~/eclipse -clean で eclipse の起動