curl -O http://ftp.gnu.org/gnu/wget/wget-1.13.4.tar.gz
tar -xzf wget-1.13.4.tar.gz
cd wget-1.13.4
./configure --with-ssl=openssl
make && make install
wget --help
cd .. && rm -rf wget*
2012년 5월 31일 목요일
MAC OS X에 톰캣 설치하기
# 터미널 실행 후 관리자 로그인
$ sudo su
$ cd /usr/local/src
$ wget http://ftp.daum.net/apache/tomcat/tomcat-7/v7.0.27/bin/apache-tomcat-7.0.27.tar.gz
$ tar xvfz apache-tomcat-7.0.27.tar.gz
$ mv apache-tomcat-7.0.27 /usr/local
# 사용자에 관리 권한 부여
$ chown -R foot:staff /usr/local/apache-tomcat-7.0.27
$ exit
# 실행
$ /usr/local/apache-tomcat-7.0.27/bin/startup.sh
# 브라우저에서 locahost:8080 접속
# 정지
$ /usr/local/apache-tomcat-7.0.27/bin/shutdown.sh
$ sudo su
$ cd /usr/local/src
$ wget http://ftp.daum.net/apache/tomcat/tomcat-7/v7.0.27/bin/apache-tomcat-7.0.27.tar.gz
$ tar xvfz apache-tomcat-7.0.27.tar.gz
$ mv apache-tomcat-7.0.27 /usr/local
# 사용자에 관리 권한 부여
$ chown -R foot:staff /usr/local/apache-tomcat-7.0.27
$ exit
# 실행
$ /usr/local/apache-tomcat-7.0.27/bin/startup.sh
# 브라우저에서 locahost:8080 접속
# 정지
$ /usr/local/apache-tomcat-7.0.27/bin/shutdown.sh
2012년 5월 30일 수요일
aws ec2에 python + django + nginX + uWSGI
# ec2 AMAZON linux
# python 2.7.2 + uWSGI-0.9.6.5 + Django-1.4 + nginx-1.0.2
yum -y upgrade
yum -y groupinstall 'Development Tools' install openssl-devel* zlib*.x86_64
yum -y install zlib-devel
wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar xvzf Python-2.7.2.tgz
cd Python-2.7.2
./configure --prefix=/opt/python2.7.2 --with-threads --enable-shared
make
make install
# 터미널에서 python -V 실행시 설치한 버전이 아닌 이전 버전으로 나타난다면
# 파일 경로 우선 순위에서 예전 python이 새로 설치한 python 보다 앞서는 경우이다.
# 이 경우 두 가지 방법으로 해결.
# 첫번째 : 현재 python에 연결된 python 심볼릭 링크 경로를 새로 설치한 python 경로로 변경
sudo rm /usr/bin/python
ln -s /opt/python2.7.2/bin/python2.7 /usr/bin/python
rm /usr/lib/python
ln -s /opt/python2.7.2/lib/python2.7 /usr/lib/python
rm /usr/include/python2.5
ln -s /opt/python2.7.2/include/python2.7 /usr/include/python
# 두 번째 : ~/.bash_profile의 python 실행 경로의 우선 순위를 바꾸는 것.
# ~/.bash_profile 파일에 경로 설정(PATH)에서 방금 설치한 python 경로를 앞에 둔다.
vi ~/.bash_profile
# /opt/python2.7.2/bin:/opt/python2.7.2/lib:/opt/python2.7.2/include
# 을 맨 앞에 넣어 다음과 같이 만든다.
export PATH=/opt/python2.7.2/bin:/opt/python2.7.2/lib:/opt/python2.7.2/include:/usr/local/bin:$PATH
uWSGI
-------------
yum install python-devel libxml2 libxml2-devel zlib-devel
cd /opt/
wget http://projects.unbit.it/downloads/uwsgi-0.9.6.5.tar.gz
tar -zxvf uwsgi-0.9.6.5.tar.gz
mv uwsgi-0.9.6.5/ uwsgi/
cd uwsgi/
python setup.py build
make
useradd -M -r --shell /bin/sh --home-dir /opt/uwsgi uwsgi
chown -R uwsgi:uwsgi /opt/uwsgi
touch /var/log/uwsgi.log
chown uwsgi /var/log/uwsgi.log
setuptools, pip
-------------
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
tar zxvf setuptools-0.6c11.tar.gz
python setup.py build
python setup.py install
# pip는 easy_install이랑 비슷하지만 훨씬 더 다양한 기능들을 갖고 있다. 특정 패키지를 버전별로 설치한다던가, 삭제한다던가, 여러 패키지를 한번에 설치한다던가가 가능
easy_install pip
django 설치
-------------
wget https://www.djangoproject.com/download/1.4/tarball/
tar xvfz Django-1.4.tar.gz
cd Django-1.4
sudo python setup.py install
cd /home/user
django-admin startproject project
cd project
python manage.py startapp app
# /home/user/project 에 django.ini를 만들어준다.
[uwsgi]
socket = 127.0.0.1:9001
chdir = /home/user/project
pythonpath = /home/user
env = DJANGO_SETTINGS_MODULE=project.settings
module = django.core.handlers.wsgi:WSGIHandler()
master = true
processes = 4
daemonize = /home/user/project/uwsgi.log
pidfile = /home/user/project/uwsgi.pid
uwsgi django.ini
nginx
----------------------
sudo yum install pcre pcre-devel
wget http://nginx.org/download/nginx-1.0.2.tar.gz
tar xvfz nginx-1.0.2.tar.gz
cd nginx-1.0.2
./configure --prefix=/opt/nginx --user=nginx --group=nginx
make
sudo make install
# /etc/init.d/nginx 스크립트 등록
wget -O init-rpm.sh http://library.linode.com/assets/662-init-rpm.sh
sudo mv init-rpm.sh /etc/rc.d/init.d/nginx
sudo chmod +x /etc/rc.d/init.d/nginx
sudo /sbin/chkconfig nginx on
vi /opt/nginx/conf/nginx.conf
server {
listen 80;
root /home/user/proj;
server_name mydomain.com;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9001;
}
}
2012년 5월 24일 목요일
아마존 EC2를 Coda의 SFTP를 이용하여 접속하기 - Mac
$ cp ap_northeast_1.pem ~/.ssh
$ chmod 700 ~/.ssh/ap_northeast_1.pem
$ vi ~/.ssh/config
# EC2 Tokyo:
Host *.ap-northeast-1.compute.amazonaws.com
IdentityFile ~/.ssh/ap_northeast_1.pem
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentitiesOnly yes
ForwardAgent no
Coda에 세팅하기
protocol : sftp 선택
server : ec2의 elastic IP 입력
username : ec2-user
password : 패스워드 입력 인풋 우측의 열쇠 버튼을 클릭하여 .pem파일을 선택
2012년 5월 16일 수요일
AWS EC2 설정하기
Instance Launch Configuaration : Amazon Linux AMI 2012.03 64bit
$MacBook-Pro:aws foot$ mkdir .aws
$MacBook-Pro:aws foot$ cp privatekey.pem .aws
$MacBook-Pro:aws foot$ chmod 400 .aws/privatekey.pem
$MacBook-Pro:aws foot$ ssh -i .aws/privatekey.pem ec2-user@xxxxxxx.compute-1.amazonaws.com
The authenticity of host 'xxxxxxxx.compute-1.amazonaws.com (xx.xx.xxx.xxx)' can't be established.
RSA key fingerprint is 7f:6b:48:a5:a5:8d:e2:4f:b7:ff:99:d5:ce:33:0f:6a.
Are you sure you want to continue connecting (yes/no)? yes
$ sudo yum update
Updated:
aws-amitools-ec2.noarch 0:1.4.0.7-1.2.amzn1 aws-apitools-ec2.noarch 0:1.5.3.0-1.0.amzn1 aws-apitools-rds.noarch 0:1.6.001-1.5.amzn1
bind-libs.x86_64 32:9.7.3-8.P3.17.amzn1 bind-utils.x86_64 32:9.7.3-8.P3.17.amzn1 initscripts.x86_64 0:9.03.27-1.18.amzn1
iproute.x86_64 0:3.2.0-3.7.amzn1 iptables.i686 0:1.4.12-2.15.amzn1 iptables.x86_64 0:1.4.12-2.15.amzn1
libpng.x86_64 2:1.2.49-1.12.amzn1 libudev.i686 0:173-3.20.amzn1 libudev.x86_64 0:173-3.20.amzn1
ntp.x86_64 0:4.2.4p8-2.16.amzn1 ntpdate.x86_64 0:4.2.4p8-2.16.amzn1 python-boto.noarch 0:2.3.0-1.0.amzn1
ruby.x86_64 0:1.8.7.357-1.18.amzn1 ruby-libs.x86_64 0:1.8.7.357-1.18.amzn1 system-release.noarch 0:2012.03-7.0
udev.x86_64 0:173-3.20.amzn1
Complete!
APM 설치
++ 루트 권한 획득
$ sudo su
$ sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd
$sudo yum list available | grep MySQL
$ sudo yum install mysql-server
$ sudo /etc/init.d/mysqld start
$ mysqladmin -u root password 'password'
$ mkdir /home/ec2-user/www
$ vi /etc/httpd/conf/httpd.conf
DirectoryIndex index.html index.php
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot 웹문서경로
ServerName 서버이름
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
$ sudo /etc/init.d/httpd start
$ sudo chkconfig --levels 235 mysqld on
$ sudo chkconfig --levels 235 httpd on
$MacBook-Pro:aws foot$ mkdir .aws
$MacBook-Pro:aws foot$ cp privatekey.pem .aws
$MacBook-Pro:aws foot$ chmod 400 .aws/privatekey.pem
$MacBook-Pro:aws foot$ ssh -i .aws/privatekey.pem ec2-user@xxxxxxx.compute-1.amazonaws.com
The authenticity of host 'xxxxxxxx.compute-1.amazonaws.com (xx.xx.xxx.xxx)' can't be established.
RSA key fingerprint is 7f:6b:48:a5:a5:8d:e2:4f:b7:ff:99:d5:ce:33:0f:6a.
Are you sure you want to continue connecting (yes/no)? yes
$ sudo yum update
Updated:
aws-amitools-ec2.noarch 0:1.4.0.7-1.2.amzn1 aws-apitools-ec2.noarch 0:1.5.3.0-1.0.amzn1 aws-apitools-rds.noarch 0:1.6.001-1.5.amzn1
bind-libs.x86_64 32:9.7.3-8.P3.17.amzn1 bind-utils.x86_64 32:9.7.3-8.P3.17.amzn1 initscripts.x86_64 0:9.03.27-1.18.amzn1
iproute.x86_64 0:3.2.0-3.7.amzn1 iptables.i686 0:1.4.12-2.15.amzn1 iptables.x86_64 0:1.4.12-2.15.amzn1
libpng.x86_64 2:1.2.49-1.12.amzn1 libudev.i686 0:173-3.20.amzn1 libudev.x86_64 0:173-3.20.amzn1
ntp.x86_64 0:4.2.4p8-2.16.amzn1 ntpdate.x86_64 0:4.2.4p8-2.16.amzn1 python-boto.noarch 0:2.3.0-1.0.amzn1
ruby.x86_64 0:1.8.7.357-1.18.amzn1 ruby-libs.x86_64 0:1.8.7.357-1.18.amzn1 system-release.noarch 0:2012.03-7.0
udev.x86_64 0:173-3.20.amzn1
Complete!
APM 설치
++ 루트 권한 획득
$ sudo su
$ sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd
$sudo yum list available | grep MySQL
$ sudo yum install mysql-server
$ sudo /etc/init.d/mysqld start
$ mysqladmin -u root password 'password'
$ mkdir /home/ec2-user/www
$ vi /etc/httpd/conf/httpd.conf
DirectoryIndex index.html index.php
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot 웹문서경로
ServerName 서버이름
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
$ sudo /etc/init.d/httpd start
$ sudo chkconfig --levels 235 mysqld on
$ sudo chkconfig --levels 235 httpd on
피드 구독하기:
글 (Atom)