우분투에 APM을 설치하는 방법입니다.
일단 터미널을 여신 후에 아래 내용을 하나씩 복사&붙여넣기 해주세요.
1. 아파치 서버 설치
sudo apt-get install apache2
2. MySQL 인증 모듈 설치
sudo apt-get install libapache2-mod-auth-mysql
3. MySQL 서버/클라이언트 설치
sudo apt-get install mysql-server mysql-client
외부접근가능 세팅
my.cnf 에서 외부접속 관련사항 변경하기
sudo nano /etc/mysql/my.cnf
3.1 다음과 같이 나오면 ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # # * IMPORTANT: Additional settings that can override those from this file! # The files must end with '.cnf', otherwise they'll be ignored. # !includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/ |
3.3 sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
파일 내용중
#bind-address = 127.0.0.1
부분 주석처리후 저장하기
4. PHP 설치
sudo apt-get install php5 php5-cli curl memcached php5-curl php5-gd php5-memcache php5-mysql php-apc php5-xsl php5-imap libssh2-php libapache2-mod-php5 php5-gd php5-xmlrpc php5-intl
ubunt 16.0 ~
1 2 3 4 5 6 |
sudo apt-get install python-software-properties sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install -y php7.1 |
1 2 3 |
sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml |
1 2 3 4 5 6 |
sudo apt-get install python-software-properties sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install -y php5.6 |
5. 아파치 서버 재시작
sudo /etc/init.d/apache2 restart
6. 작동 상태 확인 (Check to see if it works)
sudo netstat -tap | grep mysql
올바르게 작동된다면 “LISTEN” 이라는 문구가 뜹니다
그렇지 않다면, mysql을 재시작해주세요.
sudo /etc/init.d/mysql restart
7. 아파치 및 MySQL 디폴트 디렉토리
Apache configuration: /etc/apache2/apache2.conf
Apache root location: /etc/apache2/sites-available/default
MySQL configuration: /etc/mysql/my.cnf
Default Web root: /var/www
phpmyadmin 설치하기
1. 설치하기
$ sudo apt-get install phpmyadmin
2. 설정하기
$ sudo vi /etc/apache2/apache2.conf
맨 마직막에 아래 구문 추가
# Enable PhpMyAdmin
Include /etc/phpmyadmin/apache.conf
Apache 재시작
$ sudo /etc/init.d/apache2 restart
PhpMyAdmin 접속
http://localhost/phpmyadmin
3. 삭제하기
$ sudo apt-get remove phpmyadmin
*Changing the default localhost folder
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/site1
#sudo nano /etc/apache2/sites-available/site1
Change DocumentRoot /var/www to DocumentRoot /home/user/public_html.
Change to .
Save and exit the file.
Disable the default setting and make active the site1 settings
sudo a2dissite default && sudo a2ensite site1
Lastly, restart the apache.
#sudo /etc/init.d/apache2 restart
With this trick, you can create multiple site configuration file, each pointing to a different folder.
You can then easily switch between the sites with the a2dissite and a2ensite command
Enabling .htaccess file
.htaccess file is a powerful file that can be used to control and customize a site server behavior
without editing the core Apache module. By default, the .htaccess functionality is turned off
and all instances of .htaccess files are completely ignored.
The server will not even attempt to read .htaccess files in the filesystem.
To enable .htaccess file, open up the settings file that you have created earlier:
#sudo vi /etc/apache2/sites-available/site1
Scroll down the file until you see the part ““.
Underneath that line of code, change AllowOverride None to AllowOverride All.
*IP allow/Deny
allow from 210.111.111.0/24
– vsftpd 세팅
1) sudo apt-get install vsftpd
2)세팅
sudo vi /etc/vsftpd.conf
추석제거
1 2 3 4 5 6 7 8 9 10 |
anonymous_enable=NO # NO로 변경 local_enable=YES # 주석제거 write_enable=YES # 주석제거 chroot_local_user=YES # 주석제거 #chroot_list_enable=YES # 아래 리스트로 계정 추가 할때 # (default follows) #chroot_list_file=/etc/vsftpd.chroot_list # 주석제거 사용자 추가 |
pam_service_name=ftp #vsftp 필요시 변경
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# 아래 사항 추가 # Show hidden files and the "." and ".." folders. # Useful to not write over hidden files: force_dot_files=YES # Hide the info about the owner (user and group) of the files. hide_ids=YES # Connection limit for each IP: max_per_ip=2 # Maximum number of clients: max_clients=10 allow_writeable_chroot=YES #seccomp_sandbox=NO |
1 2 3 4 5 6 7 |
sudo mkdir /home/user01 sudo useradd -c testuser -d /home/user01 -s /usr/sbin/nologin -d /home/user01 userId sudo passwd user01 #소유자 변경 sudo chown -R user01:user01 /home/user01 |
반드시 : Add “/usr/sbin/nologin” to /etc/shells file to enable login access for the users who uses nologin shell.
1 2 3 |
echo "/usr/sbin/nologin" | sudo tee -a /etc/shells |
3)사용자 추가
sudo mkdir /home/user01
sudo useradd -s /bin/ksh -d /home/user01 user01
sudo passwd user01
소유자 변경
sudo chown -R user01:user01 /home/user01
**// web 사용 ftp
1 2 3 4 5 |
sudo adduser user01 www-data sudo chown -R user01:www-data /var/wwwc sudo chmod -R g+rw /var/www/user01 |
셀변경
sudo chsh -s /bin/sh user01
홈디렉토리 변경
usermod -d /home/user01 user01
# chroot list 사용시
sudo nano /etc/vsftpd.chroot_list
user01
4) vsftp 재시작
sudo /etc/init.d/vsftpd reload
sudo /etc/init.d/vsftpd restart
5) vsftp 확인
sudo netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
– config 위치들
1. 아파치 기본 설정 : sudo vi /etc/apache2/apache2.conf
2. 포트 설정 : sudo vi /etc/apache2/ports.conf
3. public 파일 설정 : sudo vi /etc/apache2/mods-enabled/dir.conf
4. 언어셋관련 설정 : sudo vi /etc/apache2/mods-enabled/autoindex.conf
5. 파일타입 설정 : sudo vi /etc/apache2/mods-enabled/mime.conf
6. 웹서비스 설정 : sudo vi /etc/apache2/sites-enabled/000-default
7. php.ini 위치 : /etc/php5/apache2/php.ini
– html, php 확장자가 사용 가능하도록 변경
sudo nano /etc/apache2/mods-enabled/mime.conf
파일에서 AddType application/x-bzip2 .bz2 밑에
AddType application/x-httpd-php .php .phtml .html .htm 등록
:wq! 하여 저장하고 나옴
sudo /etc/init.d/apache2 restart