2008년 5월 28일 수요일

trac on fedora core

Trac on Fedora Core¶

Installing Trac On Fedora Core 4 (and higher), and also on RHEL 4 or higher is easy with Yum and involves only 3 steps:

1) Verify you have configured Yum to use the Extras repository (which is enabled by default in Fedora Core 4 and higher) and run the following command in a terminal window:

$ sudo yum install trac
Yum will take care of all dependencies on which the Trac package depends (including the python-clearsilver package) and will fetch and install them for you automatically.

NOTE: Unless you're on Fedora 7, in which case, you will need to also install python-sqlite2 if you are using the default sqlite backend.

2) Create a new project environment. An environment is basically a directory that contains a human-readable configuration file and various other files and directories.

Create a subversion repository if you don't already have one, for example in /srv/svn:

$ sudo mkdir -p /srv/svn
$ sudo svnadmin create --fs-type fsfs /srv/svn
Next you need to decide where to store your trac project and create the directory, for example in the new directory /srv/trac:

$ sudo mkdir -p /srv/trac
Then create a new environment using trac-admin, as in this example for project foobar

$ sudo trac-admin /srv/trac/foobar initenv
Now make it owned by apache:

$ sudo chown -R apache /srv/trac
$ sudo chown -R apache /srv/svn
3) Next, you need to edit the file /etc/httpd/conf.d/trac.conf to point to your new project environment, as in this example (using mod_python):

# The Location is the part after the host (http://example.com) that
# you want to serve the Trac site

SetHandler mod_python
PythonHandler trac.web.modpython_frontend
# "/svn/trac/foobar" is the folder you gave to trac-admin initenv earlier
PythonOption TracEnv /srv/trac/foobar
# "/trac" is the same as the Location above
PythonOption TracUriRoot /trac
# "/tmp" should be some writable temporary directory
SetEnv PYTHON_EGG_CACHE /tmp
# "trac" can be any string, but must be the same for all
# Trac instances on the same Apache install
PythonInterpreter trac


AuthType Basic
AuthName "alexandria"
AuthUserFile /srv/trac/conf/trac.htpasswd
Require valid-user

The example above assumes you have a trac project environment setup in /srv/trac/foobar/ directory, described in step 2 and an htpasswd file at /opt/trac/trac.htpasswd for authentication purposes (see also wiki:TracModPython (too generic)).

You will need to tell Apache to reload configuration after editing trac.conf:

$ sudo service httpd reload
Verify your Trac installation by pointing your browser at the correct URL for your Trac server (e.g. http://localhost/trac).

Notes on the Fedora Extras Trac package:

trac.cgi and trac.fcgi are installed in /var/www/cgi-bin/ (actually, /usr/share/trac/cgi-bin for FC5).
apache webserver config file is installed in /etc/httpd/conf.d/trac.conf
If you happen to come across any packaging issues, feature requests or problems on Fedora, you can submit a bugzilla bug for the Trac package at https://bugzilla.redhat.com/bugzilla/easy_enter_bug.cgi.

Be sure to check out the generic installation instructions in the TracGuide

SELinux¶
Fedora Core 5 ships with SELinux enabled by default. You need to make the Trac and Subversion directory accessible to the webserver. If you put these contents under /var/www/trac and /var/www/svn to follow RedHat's standard for location of web contents, you don't need to do anything extra for SELinux. But if you want an alternative location such as /srv, follow thiese guidelines and read the notes at http://fedora.redhat.com/docs/selinux-apache-fc3/ for details.

$ sudo chcon -R -t httpd_sys_content_t /srv/trac
$ sudo chcon -R -t httpd_sys_content_t /srv/svn
If you put these under /srv/www/trac and /srv/www/svn instead, the restorecon command will know that these attributes should be preserved. Alternatively, you can teach restorecon about these two directories by adding the lines:

/srv/trac(/.*)? system_u:object_r:httpd_sys_content_t
/srv/svn(/.*)? system_u:object_r:httpd_sys_content_t
to the file /etc/selinux/targeted/contexts/files/filecontexts.local. You may need to create this file if it is not already present. If SELinux continues to block write access for Trac, you may have the httpd_unified policy turned off. In this case, try these lines instead:

/srv/trac(/.*)? system_u:object_r:httpd_sys_content_rw_t
/srv/svn(/.*)? system_u:object_r:httpd_sys_content_rw_t

Reference : trac.edgewall.org

fedora 서버에 trac 설치하기

1) 먼저 trac 을 설치한다
$yum install trac

2) trac 에 사용할 폴더를 만든다
$trac-admin /home/trac initenv

3) 위와 같이 입력한 후 다음과 같이 설정한다
Project Name [My Project]> test
Database connection string [sqlite:db/trac.db]> 'just ENTER'
Repository type [svn]> 'just ENTER'
Path to repository [/path/to/repos]> /home/svn
Templates directory [/usr/local/share/trac/templates]> 'just ENTER'
...
Congratulations!

4) 권한 설정을 해준다
$ chown -R apache /home/trac
$ chown -R apache /home/svn

5) mod_python.so 를 설치한다
$ yum install mod_python

6) apache 설정을 해준다
$ vi etc/httpd/conf/httpd.conf 를 입력한 후
다음과 같은 내용을 추가한다
LoadModule python_module modules/mod_python.so
AddHandler mod_python .psp .psp_ .py
PythonHandler mod_python .cgihandler | .py

7) trac 설정을 해준다
$ vi etc/httpd/conf.d/trac.conf 를 입력한 후
다음과 같은 내용을 추가한다 (※ 나머지 내용은 다 블럭처리 해버린다)
<Location /trac>
AuthType Basic
AuthName "Trac"
AuthUserFile /etc/svn-auth-file
Require vallid-user

SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /home/trac
PythonOption TracUriRoot /trac
SetEnv PYTHON_EGG_CACHE /tmp
#PythonDebug on
</Location>

※ 여기서 /etc/svn-auth-file 은 subversion 에 부여한 계정이다
※ 앞의 svn 설치 쪽에 보면 계정 설정하는 부분이 있다

8) apache service restart
$ service httpd restart

9) 접속 확인
http://210.99.132.246/trac

2008년 5월 25일 일요일

linux php 한글 깨짐 현상 해결 (fedora)

/etc/httpd/conf

vi httpd.conf

AddDefaultCharset UTF-8 -> AddDefaultCharset EUC-KR 로 수정 후

service httpd restart 하면 정상 작동된다

2008년 5월 22일 목요일

How do I install mod_dav_svn?

2.2. How do I install mod_dav_svn?

Installing mod_dav_svn by Gregg Pollack (gregg at patchedsoftware dot com)

1. Install mod_dav_svn
sudo yum install mod_dav_svn

2. Add the LoadModule lines to your httpd:

To edit the httpd.conf:
sudo vi /etc/httpd/conf/httpd.conf

Search for the LoadModule lines, and add these to the bottom:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

3. Create an HTTP authentication file - To setup and create the authentication file for the first time, run:

sudo htpasswd -cm /etc/svn-auth-file

To add new users to this file, use

sudo htpasswd -m /etc/svn-auth-file

NOTE: If when you run this command, you may get "Command not found". this is because you don't have /usr/sbin/ in your path directory. So lets do that now.

run "vi ~/.bash_profile", and add to the end of your path, so it looks like this:

PATH=$PATH:$HOME/bin:/usr/sbin:/sbin

Then run ". ~/.bash_profile" to execute your bash_profile and go back up to step 3.

4. Railsmachine creates an apache config file for each of your domains, in /etc/httpd/conf/apps/. Find the application that you want to add svn to, and edit the conf file. In my case, the website was www.MyDietSolution.com. I added this to the top of the /etc/httpd/conf/apps/myabsolutediet.conf file:


ServerName svn.myabsolutediet.com


DAV svn
SVNPath /var/www/apps/myabsolutediet/repos
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/absolute-auth-file
Require valid-user



5. You don't have to worry about changing any file permissions, as other subversion http tutorials might tell you. deploy user already runs apache.

6. Restart your apache:
sudo /etc/init.d/httpd restart

7. Test out your application by going to http://svn.YourDomain.com/, and it should prompt for authorization, and then show you the repository!

8. You want to enable SSL security so your passwords and code aren't sent in plaintext? Keep on following. This is assuming you don't already have your own Cert. If you do have your own cert, skip down to the bottom of the page.

First you'll want to create your own private cert (if you don't have one and don't want to pay for one). Follow these instructions to create your own. You'll need to input a passphrase you can remember for later too.

mkdir ~/sslcert
cd ~/sslcert

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

9. edit your virtualhost tag again, change the port, and add the three SSL lines. Like:


ServerName svn.myabsolutediet.com
SSLEngine On
SSLCertificateFile /home/deploy/sslcert/server.crt
SSLCertificateKeyFile /home/deploy/sslcert/server.key

10. If you're using a different subdomain, "svn.yourdomain.com", make sure your dns has a CNAME Record called svn so it forwards properly. You wouldn't need to worry about this if all subdomains forward to your server.

11. Restart apache:
sudo /etc/init.d/httpd restart

Then go to https://svn.yourdomain.com/ and you should be prompted for the cert, and for authorization, and you're golden.

12. You will be asked for your key everytime you restart apache. To get around this:

cd ~/sslcert
cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key

-----

So you have your own CERT?

I'm going to assume you configured this using railsmachine's scripts, and that your webserver conf file (/etc/httpd/conf/apps/myabsolutediet.conf) has two parts, one for port 80 and another for port 443. I'm also going to assume that your Certificate is setup properly.

1. Under your port 443 virtual host, create an alias for your svn server if you like:

ServerAlias svn.yourdomain.com

If you do use svn.yourdomain.com make sure your dns has a CNAME Record called svn so it forwards properly. You wouldn't need to worry about this if all subdomains forward to your server.

2. Add your location directives:


DAV svn
SVNPath /var/www/apps/myabsolutediet/repos
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/absolute-auth-file
Require valid-user


This is a little different then the Location we used the first time. Notice this time we're giving a path name "Location /svn", so we're only directed to svn if we go to that path in our URL.

3. Now we need to tell apache, that we DON'T want to redirect incoming requests that have SVN in the URL to our mongrel cluster. Put the following line BEFORE the "RewriteRule ^/(.*)$ balancer://servername_cluster%{REQUEST_URI} [P,QSA,L]" directive:

RewriteCond %{REQUEST_URI} !^/svn*

4. Restart the server, and try going to https://domain_name.com/svn/

-------

Adding Multiple Repositories

1. All you need to do to add multiple repositories, without adding more IP addresses, is add multiple Location directives.


DAV svn
SVNPath /var/www/apps/domain1/repos
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/domain1-auth-file
Require valid-user



DAV svn
SVNPath /var/www/apps/domain2/repos
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/domain2-auth-file
Require valid-user


2. If you want to be able to have a different base url, just add a new alias:

ServerAlias svn.domain1.com
ServerAlias svn.domain2.com

Reference : railsmachine

subversion 설치 및 설정하기 (fedora)

1) 패키지 설치
# yum install subversion
# yum install mod_dav_svn

2) 디렉토리 추가, 파일 추가
/home/svn - 버전 관리 파일을 보관하는 디렉토리
# mkdir /home/svn
# svnserve -d -r /home/svn/ - svn 서비스를 제공할 폴더 지정
# cd /home/svn
# svnadmin create sample

3) svn repository 수정
# cd /home/svn/conf
# vi svnserve.conf -> #하나로 표시된 것의 #마크를 지워준다. 주의!auth-db=는 지우면 안된다.
# cd /home/svn/conf
# vi passwd -> 아이디 비밀번호 지정

4) svn test
#svn checkout svn://(IP or localhost)/sample
-> id, password 입력후 정상 작동하는지 확인

5) 권한 설정
/home/svn# chmod -R g+w sample
/home/svn# chown -R apache.apache sample

6) /etc/svn-auth-file - 사용자 이름 및 패스워드 저장 파일 생성
# htpasswd -cm /etc/svn-auth-file simon [처음 만들 시]
# htpasswd -m /etc/svn-auth-file harry [추가할 시]
일단 명령어를 입력하면 비밀번호 입력창이 나온다

7) 아파치 설정변경
#vi /etc/httpd/conf/httpd.conf
LoadModule dav_svn_module modules/mod_dav_svn.so 추가
LoadModule authz_svn_module modules/mod_authz_svn.so 추가
마지막 부분에 추가
<VirtualHost *:80>
<Location>
   DAV svn
   SVNPath /home/svn/sample
   AuthType Basic
   AuthName "SVN repository"
   AuthUserFile /etc/svn-auth-file
   Require valid-user
</Location>
</VirtualHost>

8) Apache 재시동
/etc/init.d/httpd restart 또는
service httpd restart

9) test
wep 창을 열어서 http://(hostaddress)/svn 입력한 후 부여한 후 id와 password 를 입력하면 그림과 같은 창을 볼 수 있다.

※ 주의 사항 ※
selinux 가 실행중이라면 정상작동을 하지 못하는 경우가 있다.
이럴때는 #vi /etc/selinux/config
SELINUX=disabled -> 로 변경해 주거나
[GUI]
프로그램메뉴의 시스템 설정 -> 보안수준 -> SELinux -> 사용안함으로 설정하면 된다.

forsilver 용어 사전 완료

http://www.forsilver.net/dictionary/index.jsp

2008년 5월 20일 화요일

linux instruction

데몬 설정 ntsysv
방화벽 설정 lokkit

폴더에 내용이 있어도 제거
rm -f -r [폴더 이름]

net 상태 보기
sudo netstat -l -p

한페이지씩 보기
ls [pipe] more

fedora 부팅시 vnc 재시작 명령
service vncserver restart
! 서비스 재시작 명령을 부팅시에 자동으로 실행할 수 있도록
설정하는 법을 알아 볼것