본문 바로가기
공부방/서버구축

[리눅스] wordpress 설치 및 설정 방법

by 빵끗미 2022. 7. 1.
반응형

안녕하세요 빵끗미에요

 

오늘은 wordpress 설치 및 설정 방법에 대해서 알아보도록 할게요.

 

우선 wordpress 설치하기 전에 os 환경 구성이 apache, php, mysql 설치가 되어 있어야 돼요.

 

아직 apache, php, mysql 설치가 안되어 있다면 apache, php, mysql 설치를 해야 해요.

 

환경이 apache, php, mysql 모두 설치가 되어 있다면 작업은 아래와 같이 작업을 진행하면 돼요.

 

첫 번째 wordpress 홈페이지에 가서 wordpress를 다운로드를 하거나

 

wget 명령어를 이용하여 리눅스 서버에 바로 다운로드를 해요.

 

https://wordpress.org/download/ wordpress 한국 홈페이지
wget https://wordpress.org/latest.tar.gz latest.tar.gz 파일 서버에 바로 다운로드 함

 

 

두 번째 latest.tar.gz 파일 압축해제를 해줘야 해요.

# tar zxvf latest.tar.gz  latest.tar.gz  압축 해제

 

 

세 번째 압축된 파일명을 관리자가 관리하기 쉽도록 변경을 해요

# mv latest wordpress latest 파일명을 wordpress로 변경 해요.

 

 

네 번째 wordpress 폴더 안으로 들어가서 wp-config.sample.php 파일을 복사해요

#cp wp-config.sample.php wp-config.php wp-config.php 파일은 워드프레스 설정값을 세팅하는 파일이에요.

 

 

다섯 번째 wordpress/wp-content 경로 이동하여 uploads 폴더를 생성해요

ㄴ 사이트 구성시 파일 업로드를 진행하기 위해서는 uploads 폴더 생성이 필요해요.

# mkdir uploads mkdir 명령어는 폴더를 만들수 있는 명령어 에요.
# chmod -R 777 wordpress uploads 폴더 권한을 변경해요. 

*uploads 폴더에 쓰기 권한이 없으면 업로드가 되지 않아요.

 

 

여섯 번째로 DB와 연동하기 위해서 mysql 데이터베이스를 생성해야 돼요.

# mysql -u root -p root 계정으로 mysql 접속 해요. 
Enter password:  mysql 패스워드를 입력 해서 db 연결 해요.
create database wordpress; 데이터 베이스 wordpress를 생성해요
grant all privileges on wordpress.* to root[사용자계정]@localhost identified by 'test111[패스워드]'; 외부에서 접근 가능 하도록 설정 해요
flush privileges; 모든 설정이 끝났다면 적용을 해요
exit mysql 종료 해요

 

 

일곱 번째 wordpress 폴더로 이동하여 wp-config.php 파일에 db와 연결될 수 있도록 설정해야 돼요.

# vi wp-config.php vi 편집기를 이용하여 wp-config.php파일을 편집해요.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', <strong>'wordpress'</strong>);
 
/** MySQL database username */
define('DB_USER', <strong>'root'</strong>);
 
/** Database password */
define( 'DB_PASSWORD', 'test111' );



define('AUTH_KEY',         '7)X>ubIU,pUe9OYVfg=k+pmlDXdQ^vP^XA|SPKJ@rFr|75EX)}>p-1OO6JEqlDc}');

define('SECURE_AUTH_KEY',  'w(|2wh~|AB9d[HJ`f7$D.z))AXWH$a<R~U$tqeSdE<8|y;Se%{d<i+Wbp%[v})I%');

define('LOGGED_IN_KEY',    'E4k)!F!M_sEs5[e6[M>4X)VE_aGCK?#~^K=#<rDZp B:)`(d@)`K(76?1CJwb6~U');

define('NONCE_KEY',        '^Wht&olBHLSqDB.75xgD|xdlx^<K+EEkI>(NKSxs@eGahmOd)zo  (fPUsfOCwEk');

define('AUTH_SALT',        'Ug=nFh|u48}r<Ou2m;s-jRZ<1N|:AyDsP&OO|Y5t5[*Y,+8Usp$W)N!j0v.@3Ohd');

define('SECURE_AUTH_SALT', 'L,1cjY<R 7C2w|[56_~4MgKa-`.ma3fM~#p(B=l@U:_|lY;;p-fUL-dWC|<^3+7c');

define('LOGGED_IN_SALT',   '+-NG_)@+^d::n!OQeF)]=,2G-GjN<=(EGC5|fC_W9cB<XH^lNA2=S|.,P$Ht`-^r');

define('NONCE_SALT',       'onoreg&9|-oSJl2NGo/D~f-hB5Ni[9y8,b+w`>(avcIs5+/r/;?Wq46OGt,h?jKd');





:wq
DB NAME, DB USER, DB PASSWORD 입력해주세요.

아래로 스크롤 하게 되면 내용중에 

define(‘AUTH_KEY’, ‘put your unique phrase here’);
define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
define(‘NONCE_KEY’, ‘put your unique phrase here’);
define(‘AUTH_SALT’, ‘put your unique phrase here’);
define(‘SECURE_AUTH_SALT’, ‘put your unique phrase here’);
define(‘LOGGED_IN_SALT’, ‘put your unique phrase here’);
define(‘NONCE_SALT’, ‘put your unique phrase here’);

부분이 있는데 이부분는 인증 고유키를 입력하는 부분 이에요.

인증 고유키는 https://api.wordpress.org/secret-key/1.1/salt/

사이트 클릭 하시면 임의로 생성 되요.

인증 고유키를 복사넣기 한뒤 저장 해 주세요.

 

 

여덟 번째 URL에 http://localhost/wp-admin/install.php를 입력하게 되면 정상적으로 DB와 연동되었어요.

 

 

나만의 사이트 완성!!!

 

 

반응형

댓글