๐Ÿ›  Linux ์„œ๋ฒ„ ๊ตฌ์ถ•ํ•˜๊ธฐ

Cherryยท2022๋…„ 10์›” 19์ผ
1

Linux

๋ชฉ๋ก ๋ณด๊ธฐ
3/5
post-thumbnail

๐Ÿ”จ ์„œ๋ฒ„๊ตฌ์ถ•๊ณผ์ •

(์‚ฌ์ „์— DNS ๋„๋ฉ”์ธ ์„ค์ • ์™„๋ฃŒ)

1. EC2 ์„œ๋ฒ„์— SSH๋กœ ์ ‘์†

  • AWS(์•„๋งˆ์กด์›น์„œ๋น„์Šค) EC2์—์„œ ์ธ์Šคํ„ด์Šค ์‹คํ–‰ (CentOS)
  • ํ‚ค ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„์„œ pem โžก ppk๋กœ ๋ณ€ํ™˜ (puttygen)
  • PuTTy๋กœ ๋ฆฌ๋ˆ…์Šค ์ ‘์†
  • passwd๋กœ ํŒจ์Šค์›Œ๋“œ ์„ค์ • (ppk์—†์ด ssh์ ‘์†ํ•˜๊ธฐ)

2. vsftpd ์„ค์ •ํ•˜๊ธฐ

  • vsftpd ์„ค์น˜ ๋ฐ ๊ณ„์ •์ƒ์„ฑ

3. Apache , PHP, MySQL ์„ค์น˜ํ•˜๊ธฐ

  • centOS์— Apache ์„ค์น˜
  • centOS์— PHP ์„ค์น˜
  • centOS์— MySQL ์„ค์น˜ ๋ฐ ๋น„๋ฐ€๋ฒˆํ˜ธ ์„ค์ •ํ•˜๊ธฐ

4. Apache ์„ค์ •ํ•˜๊ธฐ

  • ์•„ํŒŒ์น˜ ์‹คํ–‰
  • ์•„ํŒŒ์น˜ ๋„๋ฉ”์ธ ์„ค์ •
  • ์•„ํŒŒ์น˜ PHP์™€ ์—ฐ๋™

5. PHP ์„ค์ •ํ•˜๊ธฐ

  • PHP ๋‚ด๋ถ€ ์„ค์ •

6. vhost ์„ค์ •ํ•˜๊ธฐ

7. DB ์—ฐ๊ฒฐํ•˜๊ธฐ

  • MySQL ๊ณ„์ •์ƒ์„ฑ ๋ฐ ๊ถŒํ•œ๋ถ€์—ฌ
  • HeidiSQL ์ ‘์†ํ•˜๊ธฐ

8. ๊ทธ๋ˆ„๋ณด๋“œ ์„ค์น˜ํ•˜๊ธฐ


โžฐ EC2 ์„œ๋ฒ„์— SSH๋กœ ์ ‘์†

๐Ÿ”ธ AWS(์•„๋งˆ์กด์›น์„œ๋น„์Šค) EC2์—์„œ ์ธ์Šคํ„ด์Šค ์‹คํ–‰ (CentOS)

  • ์ธ์Šคํ„ด์Šค ์‹คํ–‰๊ตฌ์กฐ

  • ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ์‹œ์— ๋ณด์•ˆ๊ทธ๋ฃน ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™ ์ˆ˜์ •

  • ํƒ„๋ ฅ์  IP ํ• ๋‹น

  • ์ธ์Šคํ„ด์Šค ์œ ํ˜• : t2.micro

  • ํ‚คํŽ˜์–ด ์ƒ์„ฑ

๐Ÿ”ธ Putty๋กœ ๋ฆฌ๋ˆ…์Šค ์ ‘์†

  • Putty ์„ค์น˜ ํ›„ Puttygen ์‹คํ–‰
  • ์ธ์Šคํ„ด์Šค ์‹คํ–‰ ์‹œ์— ๋ฐ›์•„๋‘” ํ‚คํŒŒ์ผ(.pem) ์„ ํƒ
  • Save private key๋ฅผ ํด๋ฆญํ•˜์—ฌ ์ฑ„์›Œ์ง„ ํ‚ค ์ •๋ณด๋ฅผ (.ppk)๋กœ ์ €์žฅ
  • Putty ์‹คํ–‰ํ•˜์—ฌ ํ•ด๋‹น ์ธ์Šคํ„ด์Šค์— ํ• ๋‹น๋œ ํƒ„๋ ฅ์ IP ์ •๋ณด๋ฅผ ๊ธฐ์ž…
  • SSH - Auth ์•ˆ์— Browse์— ์ €์žฅํ•œ (.ppk) ํŒŒ์ผ์„ ํƒ ํ›„ ์˜คํ”ˆ

์ฐธ์กฐ : https://sailer.tistory.com/entry/AWS-EC2-%EC%97%90-SSHPUTTY%EB%A1%9C-%EC%A0%91%EC%86%8D-%ED%95%98%EA%B8%B0-1


โžฐ vsftpd ์„ค์ •

๐Ÿ”ธ vsftpd ์„ค์น˜ ๋ฐ ๊ณ„์ •์ƒ์„ฑ

  • yum์œผ๋กœ vsftpd ์„ค์น˜ํ•˜๊ธฐ

    	yum -y install vsftpd
  • vsftpd.conf ํŒŒ์ผ ์ˆ˜์ •ํ•˜๊ธฐ

    	vi /etc/vsftpd/vsftpd.conf
  • ์ˆ˜์ •๋‚ด์šฉ
    anonymous_enable=NO
    chroot_local_user=NO
    listen=YES
    listen_ipv6=NO

  • ์ „์†ก๋ชจ๋“œ ์„ธํŒ…ํ•˜๊ธฐ
    passive mode
    passive port : 40001-40010
    pasv_enable=Yes
    pasv_max_port=11001
    pasv_min_port=11050

  • ์žฌ์‹œ์ž‘

    	systemctl restart vsftpd
  • ์„œ๋ฒ„์‹œ์ž‘ํ”„๋กœ๊ทธ๋žจ์— ๋“ฑ๋ก

    	systemctl enable vsftpd

์ฐธ์กฐ : https://sailer.tistory.com/m/entry/CentOS-์—-vsftpd-์„ค์น˜ํ•˜๊ธฐ, https://www.hostwinds.kr/tutorials/create-ftp-accounts-server


โžฐ Apache , PHP, MySQL ์„ค์น˜

๐Ÿ”ธ ๋ฆฌ๋ˆ…์Šค์— Apache ์„ค์น˜

  • ์„œ๋ฒ„์— ์ ‘์†ํ•˜์—ฌ SSH๋ฅผ ํ†ตํ•ด ๋กœ๊ทธ์ธ

    	 ssh DSM ๊ด€๋ฆฌ์ž๊ณ„์ •@DSM IP์ฃผ์†Œ -p SSH ํฌํŠธ๋ฒˆํ˜ธ
  • Apache ์„ค์น˜ํ•˜๊ธฐ

    	yum install httpd -y
  • ์„ค์น˜์ƒํƒœํ™•์ธ

    	httpd -v
  • ์„œ๋ฒ„๊ตฌ๋™

    	systemctl start httpd
  • ์ž‘๋™์ƒํƒœํ™•์ธ

    	systemctl status httpd
๐Ÿ‘‰ active๋กœ ์ƒํƒœ๊ฐ€ ํ™•์ธ๋˜๊ณ , IP๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํŽ˜์ด์ง€๋กœ ์—ฐ๊ฒฐ๋˜๋ฉด ์„ฑ๊ณต

๐Ÿ”ธ PHP ์„ค์น˜

  • Remi ๋ ˆํฌ์ง€ํ† ๋ฆฌ ํ™œ์„ฑํ™”

    	yum-config-manager --enable remi-php74
  • PHP ๋ชจ๋“ˆ ์„ค์น˜

    	 yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd   
  • ์„ค์น˜์ƒํƒœ ํ™•์ธ

    	 php -v

๐Ÿ”ธ MySQL ์„ค์น˜

  • ํŒจํ‚ค์ง€ ์„ค์น˜

    	 yum install http://dev.mysql.com/get/mysql-community-release-e17-5.noarch.rpm
  • MySQL ์„œ๋ฒ„ ์„ค์น˜

    	yum install mysql-community-server
  • ์„ค์น˜์ƒํƒœ ํ™•์ธ

    	mysql --version
  • MySQL ์‹คํ–‰

    	 systemctl enable mysqld
  • ์ž‘๋™์ƒํƒœ ํ™•์ธ

    	systemctl status mysql
๐Ÿ‘‰ active๋กœ ์ƒํƒœ๊ฐ€ ํ™•์ธ๋˜๋ฉด ์„ฑ๊ณต

์ฐธ์กฐ : https://sailer.tistory.com/m/entry/Centos-7-%EC%97%90-MYSQL-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B056-or-57

๐Ÿ”ธ MySQL ๋น„๋ฐ€๋ฒˆํ˜ธ ์„ค์ •

  • ์ดˆ๊ธฐ๊ฐ’ ์„ค์ •

    	mysql_secure_installation
  • ๋Œ€๋‹ต๋‚ด์šฉ
    Remove anonymous users? : y
    Disallow root login remotely? : y
    Remove test database and access to it? : y
    Reload privilege tables now? : y

  • ์ ‘์† ๊ฐ€๋Šฅ ์—ฌ๋ถ€ ํ™•์ธ

    	 mysql -u root -p

โžฐ Apache ๋„๋ฉ”์ธ ์„ค์ •

๐Ÿ”ธ vhost ์„ค์ • ์ฒซ๋ฒˆ์งธ

  • ๋ช…๋ น์–ด์ž‘์„ฑ

    	include /ect/httpd/conf/vhost.conf
  • ์•„๋ž˜์™€ ๊ฐ™์ด ๊ธฐ์ž…

    	<Directory "/home">
    		AllowOverride None
    		Require all granted 
    	</Directory>

๐Ÿ”ธ vhost ์„ค์ • ๋‘๋ฒˆ์งธ

  • ๋ช…๋ น์–ด์ž‘์„ฑ

    	vi /etc/httpd/conf/vhost.conf
  • ์•„๋ž˜์™€ ๊ฐ™์ด ๊ธฐ์ž…

๐Ÿ‘‰ ์„ค์ •ํ•œ ๋„๋ฉ”์ธ์œผ๋กœ ์ ‘์†ํ–ˆ์„๋•Œ Testing ํŽ˜์ด์ง€๊ฐ€ ๋œจ๋ฉด ์„ฑ๊ณต

๐Ÿ”ธ Apache-PHP ์—ฐ๋™ (Apache๊ฐ€ PHPํŒŒ์ผ์„ ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •)

  • ๋ช…๋ น์–ด ์ž‘์„ฑ

    	vi /etc/httpd/conf/httpd.conf
  • ํ•ด๋‹น๋‚ด์šฉ ๊ธฐ์ž…


โžฐ PHP ์„ค์ •

๐Ÿ”ธ PHP ๋‚ด๋ถ€์„ค์ •ํ•˜๊ธฐ

  • ๋ช…๋ น์–ด์ž‘์„ฑ

    	vi /etc/php.ini
  • ํ•ด๋‹น๋‚ด์šฉ ๊ธฐ์ž…


โžฐ vhost ์„ค์ •

๐Ÿ”ธ vhost ๋„๋ฉ”์ธ ์„ค์ •ํ•˜๊ธฐ

  • ์ˆ˜์ • ํ•  ํŒŒ์ผ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ

    	vi /etc/httpd/conf/vhost.conf
  • vhost.conf ํŒŒ์ผ ์ˆ˜์ •ํ•˜๊ธฐ

<virtualhost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

โžฐ DB ์—ฐ๊ฒฐ

๐Ÿ”ธ MySQL ๊ณ„์ •์ƒ์„ฑ ๋ฐ ๊ถŒํ•œ๋ถ€์—ฌ

  • ์„œ๋ฒ„์ ‘์†

    	mysql.server start
  • DB ๋กœ๊ทธ์ธ

    	mysql -u root -p
  • ์‚ฌ์šฉ ์ค‘์ธ ์‚ฌ์šฉ์ž ๊ณ„์ • ํ™•์ธ

    	(root ๊ณ„์ •์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ค‘ 'mysql' ์ด๋ผ๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ ํƒํ•˜๊ธฐ)
    	mysql> use mysql;
    
    	('user' ์ด๋ผ๋Š” ํ…Œ์ด๋ธ”์˜ ์ •๋ณด์—์„œ ์‚ฌ์šฉ์ž ๊ณ„์ • ํ™•์ธํ•˜๊ธฐ)
    	mysql> select host, user from user;
  • ๊ณ„์ •์ƒ์„ฑ

    	create user ๊ณ„์ •ID; 
  • localhost๋งŒ ์ถ”๊ฐ€๋œ ๊ณ„์ •์— ์™ธ๋ถ€ host ์ ‘๊ทผ ๊ถŒํ•œ ์ถ”๊ฐ€

    	mysql> create user ๊ณ„์ •ID@'%' identified by '๋น„๋ฐ€๋ฒˆํ˜ธ';
  • ๋ชจ๋“  DB, ํ…Œ์ด๋ธ” ๊ด€๋ฆฌ ๊ถŒํ•œ ๋ถ€์—ฌ

    	(privileges on [๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ด๋ฆ„].[ํ…Œ์ด๋ธ” ์ด๋ฆ„])
    	mysql> grant all privileges on *.* to ๊ณ„์ •ID@localhost idnetified by '๋น„๋ฐ€๋ฒˆํ˜ธ';
  • ๊ถŒํ•œ ๋ถ€์—ฌ ๋‚ด์šฉ ๋ฉ”๋ชจ๋ฆฌ์— ๋ฐ˜์˜

    	mysql> flush privileges;
  • ๊ถŒํ•œ์ด ์ž˜ ๋ถ€์—ฌ๋˜์—ˆ๋Š”์ง€ ํ™•์ธ

    	mysql> show grants for ๊ณ„์ •ID@localhost;

์ฐธ์กฐ : https://velog.io/@ejayjeon/MYSQL-1.-%EA%B3%84%EC%A0%95-%EC%83%9D%EC%84%B1-%EA%B6%8C%ED%95%9C-%EB%B6%80%EC%97%AC


โžฐ ๊ทธ๋ˆ„๋ณด๋“œ ์„ค์น˜ํ•˜๊ธฐ

๐Ÿ”ธ FTP์— ๊ทธ๋ˆ„๋ณด๋“œ ์„ค์น˜ํ•˜๊ธฐ

  • ์„ค์น˜์›ํ•˜๋Š” ๊ฒฝ๋กœ๋ฅผ ๋ช…๋ น์–ด์™€ ์ž…๋ ฅ

    	#pwd 
  • ๊ทธ๋ˆ„๋ณด๋“œ ์„ค์น˜ํ•˜๊ธฐ

    	wget https://github.com/gnuboard/gnuboard5/commits/master 
  • ์••์ถ•ํ’€๊ธฐ

    	tar xvzf g5.tar.gz
  • ํ•ด๋‹น ํด๋”๋กœ ์ด๋™ํ•˜์—ฌ data ํŒŒ์ผ์ƒ์„ฑ

    	mkdir data
  • chmod 707 data ๋กœ ํŒŒ์ผ ๊ถŒํ•œ๋„ ๋ณ€๊ฒฝ

๐Ÿ”ธ ๋„๋ฉ”์ธ์— ์ ‘์†ํ•˜์—ฌ ๊ทธ๋ˆ„๋ณด๋“œ ์„ค์น˜

์ฐธ์กฐ : https://idchowto.com/linux%EA%B7%B8%EB%88%84%EB%B3%B4%EB%93%9C-gnuboard5-%EC%84%A4%EC%B9%98%ED%95%B4%EB%B3%B4%EA%B8%B0/


profile
๐Ÿ’์˜ ๊ณต๋ถ€๊ณต๊ฐ„

0๊ฐœ์˜ ๋Œ“๊ธ€