{"id":17384,"date":"2016-01-01T13:31:51","date_gmt":"2016-01-01T19:31:51","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=17384"},"modified":"2022-12-15T07:18:16","modified_gmt":"2022-12-15T13:18:16","slug":"install-craft-cms-on-a-centos-7-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-craft-cms-on-a-centos-7-vps\/","title":{"rendered":"Install Craft CMS on CentOS 7"},"content":{"rendered":"
Craft is a content management system (CMS) designed for publishers who want more control and more powerful performances from their CMS. It is a PHP based application build on Yii framework. In this tutorial we will install Craft on a CentOS 7 VPS<\/a> with Apache, PHP and MariaDB.<\/p>\n <\/p>\n In order to run Craft CMS<\/a> your server needs to meet the following requirements:<\/p>\n Installing Craft is very easy. First of all log in to your server as user root and make sure that all packages are up to date by executing the following command<\/p>\n Run the following command to install MariaDB database server<\/p>\n Start the MariaDB database server and enable it to start at the boot time<\/p>\n Run the ‘mysql_secure_installation’ script to secure the database server and set your MariaDB root password<\/p>\n Log in to the MariaDB server using the ‘root’ user and create new database and user for Craft.<\/p>\n Don’t forget to replace ‘PASSWORD’ with a strong password.<\/p>\n Next, we will install Apache web server<\/p>\n Same as we did with MariaDB, start the Apache web server and add it to automatically start on the system start-up<\/p>\n Craft is PHP based application, so we need to install PHP among with few PHP modules<\/p>\n Download the latest stable release of Craft from their official website.<\/p>\n Unpack the downloaded zip archive.<\/p>\n The archive contains two directories ‘craft\/’ and ‘public\/’ . It is recommended to move the ‘craft\/’ directory above the document root directory.<\/p>\n And move the ‘public\/’ directory to the document root directory on your server and change your current working directory.<\/p>\n If you are not sure where is your document root directory you can use the following command to find out<\/p>\n Change the ownership<\/p>\n Now, we need to tell Craft how to connect to the MariaDB database. Opoen the db.conf file and enter the database information:<\/p>\n Rename the htacces file located in the ‘public\/’ directory<\/p>\n Next, create Apache virtual host for your domain. Create ‘\/etc\/httpd\/conf.d\/vhosts.conf’ directory with the following content<\/p>\n and create the virtual host<\/p>\n Restart the Apache web server for the changes to take effect.<\/p>\n Now, load Craft’s administrator panel at http:\/\/yourdomain.com\/admin to finish the installation.<\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install Craft for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS<\/strong><\/span>. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" Craft is a content management system (CMS) designed for publishers who want more control and more powerful performances from their … <\/p>\n\n
yum -y update<\/pre>\n
yum install mariadb mariadb-server<\/pre>\n
systemctl start mariadb\r\nsystemctl enable mariadb<\/pre>\n
mysql -u root -p\r\n\r\nCREATE DATABASE craft;\r\nCREATE USER 'craftuser'@'localhost' IDENTIFIED BY 'PASSWORD';\r\nGRANT ALL PRIVILEGES ON `craft`.* TO 'craftuser'@'localhost';\r\nFLUSH PRIVILEGES;<\/pre>\n
yum install httpd<\/pre>\n
systemctl start httpd\r\nsystemctl enable httpd<\/pre>\n
yum install php php-pdo php-common php-mcrypt php-mbstring<\/pre>\n
wget http:\/\/download.buildwithcraft.com\/craft\/2.4\/2.4.2670\/Craft-2.4.2670.zip<\/pre>\n
unzip Craft-2.4.2670.zip<\/pre>\n
mv craft\/ \/var\/www\/<\/pre>\n
mv public\/ \/var\/www\/html\/\r\ncd \/var\/www\/html\/\r\nmv public\/ craft\/<\/pre>\n
grep -i '^documentroot' \/etc\/httpd\/conf\/httpd.conf\r\nDocumentRoot \"\/var\/www\/html\"<\/pre>\n
chown -R apache:apache craft\/<\/pre>\n
vim ..\/..\/craft\/config\/db.php\r\n\r\n'server' => 'localhost',\r\n'user' => 'craftuser',\r\n'password' => 'PASSWORD',\r\n'database' => 'craft',\r\n'tablePrefix' => 'craft',<\/pre>\n
mv public\/htaccess public\/.htaccess<\/pre>\n
vim \/etc\/httpd\/conf.d\/vhosts.conf\r\n\r\nIncludeOptional vhosts.d\/*.conf<\/pre>\n
vim \/etc\/httpd\/vhosts.d\/yourdomain.com.conf\r\n\r\n<VirtualHost YOUR_SERVER_IP:80>\r\nServerAdmin webmaster@yourdomain.com\r\nDocumentRoot \"\/var\/www\/html\/craft\/\"\r\nServerName yourdomain.com\r\nServerAlias www.yourdomain.com\r\nErrorLog \"\/var\/log\/httpd\/yourdomain.com-error_log\"\r\nCustomLog \"\/var\/log\/httpd\/yourdomain.com-access_log\" combined\r\n\r\n<Directory \"\/var\/www\/html\/craft\/\">\r\nDirectoryIndex index.html index.php\r\nOptions FollowSymLinks\r\nAllowOverride All\r\nRequire all granted\r\n<\/Directory>\r\n<\/VirtualHost><\/pre>\n
systemctl restart httpd<\/pre>\n