CentOS 7系统安装Ghost
作者:chszs,未经博主允许不得转载。经许可的转载需注明作者和博客主页:http://blog.csdn/chszs
一、Ghost介绍
Ghost是一个开源、免费的博客平台,它基于Node.js构建,设计目标是简化在线发布博客的过程。
本文主要讲述怎样在CentOS 7上安装Ghost。
二、安装过程
1、首先确保所有的系统包为最新
# yum -y update
- 1
2、安装LAMP服务器
安装基本的LAMP环境是必须的,LAMP是指Linux、Apache、MariaDB、PHP。
1)安装Apache服务器
# yum install httpd openssl mod_ssl
- 1
重启Apache服务器
# systemctl restart httpd# systemctl status httpd# systemctl enable httpd
- 1
- 2
- 3
2)安装MariaDB数据库
# yum install mariadb mariadb-server mysql
- 1
默认情况下,MariaDB并不够安全,故应该修改其默认配置来加固其安全。使用mysql_secure_installation脚本,并注意以下的步骤细节,比如设置root账户的密码、移除匿名用户、不允许root账户远程登录、移除test数据库和时序安全访问MariaDB等。
# mysql_secure_installation
- 1
像这样进行配置:
- Set root password? [Y/n] y- Remove anonymous users? [Y/n] y- Disallow root login remotely? [Y/n] y- Remove test database and access to it? [Y/n] y- Reload privilege tables now? [Y/n] y
- 1
- 2
- 3
- 4
- 5
下一步需要登录到MariaDB控制台并为WikkaWiki创建一个数据库。运行以下命令:
# mysql -u root -p
- 1
重启MariaDB
# systemctl restart mariadb# systemctl status mariadb# systemctl enable mariadb
- 1
- 2
- 3
3)安装PHP
# yum install php php-mysql
- 1
如果PHP应用还需要一些扩展模块,可以选择安装,如下:
php-bcmath : A module for PHP applications for using the bcmath libraryphp-cli : Command-line interface for PHPphp-common : Common files for PHPphp-dba : A database abstraction layer module for PHP applicationsphp-devel : Files needed for building PHP extensionsphp-embedded : PHP library for embedding in applicationsphp-enchant : Enchant spelling extension for PHP applicationsphp-fpm : PHP FastCGI Process Managerphp-gd : A module for PHP applications for using the gd graphics libraryphp-intl : Internationalization extension for PHP applicationsphp-ldap : A module for PHP applications that use LDAPphp-mbstring : A module for PHP applications which need multi-byte string handlingphp-mysql : A module for PHP applications that use MySQL databasesphp-mysqlnd : A module for PHP applications that use MySQL databasesphp-odbc : A module for PHP applications that use ODBC databasesphp-pdo : A database access abstraction module for PHP applicationsphp-pear.noarch : PHP Extension and Application Repository frameworkphp-pecl-memcache : Extension to work with the Memcached caching daemonphp-pgsql : A PostgreSQL database module for PHPphp-process : Modules for PHP script using system process interfacesphp-pspell : A module for PHP applications for using pspell interfacesphp-recode : A module for PHP applications for using the recode libraryphp-snmp : A module for PHP applications that query SNMP-managed devicesphp-soap : A module for PHP applications that use the SOAP protocolphp-xml : A module for PHP applications which use XMLphp-xmlrpc : A module for PHP applications which use the XML-RPC protocol
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
4)配置防火墙
CentOS 7的防火墙默认会阻塞一切,故必须在防火墙允许HTTP/HTTPS通过防火墙。执行命令:
# sudo firewall-cmd --permanent --zone=public --add-service=http# sudo firewall-cmd --permanent --zone=public --add-service=https# sudo firewall-cmd --reload
- 1
- 2
- 3
3、安装Node.js和npm
运行以下命令安装Node.js和npm:
# yum install nodejs npm --enablerepo=epel
- 1
验证安装是否正确,执行:
# node -v && npm -vv0.10.261.3.6
- 1
- 2
- 3
4、安装Ghost
下载并解压Ghost:
# mkdir -p /var/www/html# cd /var/www/html# curl -L -O https://ghost/zip/ghost-latest.zip # unzip -d ghost ghost-latest.zip # cd ghost# sudo npm install --production
- 1
- 2
- 3
- 4
- 5
- 6
Ghost安装完成后,进行配置并用主机的域名更新配置文件中的URL。
# cp config.example.js config.js
- 1
打开配置文件:
# nano config.js
- 1
找到“Production”节,用域名更新URL,修改后看起来如下:
// ### Production // When running Ghost in the wild, use the production environment. // Configure your URL and mail settings here production: { url: 'http://your_domain',
- 1
- 2
- 3
- 4
- 5
至此完成了整个安装过程,可以启动Ghost了。
# npm start –production
- 1
三、访问Ghost
Ghost默认在HTTP 80端口下是可用的。所以打开浏览器,访问http://server-ip:2368,完成剩余的安装步骤。如果主机上使用了防火墙,需要允许2368端口通过。
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn/jiangjunshow
更多推荐
CentOS 7系统安装Ghost
发布评论