This page contains detailed instructions on how to build a Linux development environment, based on CentOS 7. Eventually this will cover hosting two different versions of Drupal on the same box, so that, for example, you can work on Drupal 7 and Drupal 8.
- Create a new VM in Virtual Box
• Attach two network adapters, first one using NAT, second using Host-Only
- Download CentOS 7 DVD
- Attache CentOS 7 DVD to CD drive of new VM
- Start the VM
- It will boot off CD
- Click in VM to give it control
- Select Install CentsOS 7
- On "Welcome to CentOS 7" screen choose English: English (United Kingdom), click Continue
- Installation Summary: Localization should be correct, click "Network & Hostname"
• Turn both network adapters on
• Make sure they both have "Automatically connect" checked in their configuration, set the name if you wish
• set the hostname, I used: centosvm.localdomain
• click Done
- click "Installation Destination"
• click Done
- click "Software Selection"
• Select "Development and Creative Workstation" with "FTP Server", "MariaDB Database Server", "PHP Support"
• Click Done
- wait while the changes verify
- Click "Begin Installation"
- Click "User Creation", enter details
• make sure "Make this user administrator" and "Require a password" are both checked
• click Done
- Click "Root Password" and set a root password
- wait while the installation completes.... (it runs while you set the users up)
- when the progress bar at the bottom has finished and displays "Complete!" the Reboot button is visible, click it to reboot
- don't select any options during the reboot, you will then get to a "License Information" screen
- accept the license and then click "Finish Configuration"
- leave the Kdump options at default unless you want to change them, click Forward
- click the username entered earlier and login with the password
- Confirm your chosen Language and Input Source during the GNOME Initial Setup, enter a cloud account if you wish and then click "Start using CentOS"
- close the GNOME Help
- Applications -> System Tools -> Software Update, let it process for a minute and then click "Install Updates"
- after a bit you will need to click "Yes" to trust the source of the updated packages, do so and enter your password
- a prompt will say a restart is required, just close this
- Close Software Updates and reboot
- Login
- start a Terminal Session
- su # so we become root
- yum install gcc [press y to install dependencies]
- yum install kernel-devel [press y to install dependencies]
- from the VirtualBox menu select Devices -> Insert Guest Additions CD Image
- cancel the autorun prompt
- cd /run/media/geoff/VBOXADDITIONS_4.3.18_96516 [the exact numbers will change with different versions of Virtual Box]
- sh ./VBoxLinuxAdditions.run
- now we have cursor integration working which is so much nicer
- see /media for shared folder mounts, if you have any, if not this is where they will appear
- usermod -a -G vboxsf geoff
- usermod -a -G apache geoff
- reboot, this will implement the group changes, which are needed later
- On the bottom right of the screen there should be a number 1 in a blue circle, click this. then click the floppy disk/usb stick icon and eject the Virtual Box Guest Additions CD
- systemctl start httpd.service #starts until reboot
- systemctl enable httpd.service # the autostarting command
- systemctl start mariadb.service #starts until reboot
- systemctl enable mariadb.service # the autostarting command
- mysql -u root # by default there is no password, so just login
• use mysql
• update user set password=PASSWORD('new_password') where User='root'; # this updates all root users!
• select host, user, password, super_priv from user;
• exit
- systemctl restart mariadb.service # seems we need this after changing root password for phpMyAdmin to work
- yum install epel-release
- yum install phpmyadmin
- In /etc/httpd/conf.d/phpMyAdmin.conf you might need to remove the 127.0.0.1 restrictions (see http://httpd.apache.org/docs/trunk/mod/mod_authz_core.html)
- systemctl restart httpd.service
- login to http://localhost/phpMyAdmin as root
• CREATE DATABASE drupal7 CHARACTER SET utf8 COLLATE utf8_general_ci;
• CREATE USER 'drupal7adm'@'localhost' IDENTIFIED BY 'the_password';
• GRANT USAGE ON *.* TO 'drupal7adm'@'localhost' IDENTIFIED BY 'the_password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
• GRANT ALL PRIVILEGES ON `drupal7`.* TO 'drupal7adm'@'localhost';
- cd /var/www
- chown -Rv apache:apache ./html # R = recursive, v = verbose
- chmod -v -R 775 ./html
- vi /etc/php.ini
• post_max_size = 12M
• upload_max_filesize = 12M
• save changes
- vi /etc/httpd/conf/httpd.conf
• find the section regarding Directory "/var/www/hitml"
• change AllowOverride None to AllowOverride All
• save changes
- systemctl restart httpd.service
- start a new Terminal Session as your user account
- cd ~/Downloads
- wget http://ftp.drupal.org/files/projects/drupal-7.34.tar.gz
- cd /var/www/html
- tar --strip-components=1 -xzvf ~/Downloads/drupal-7.34.tar.gz
- chown -Rv geoff:apache .
- cd ./sites/default/
- cp default.settings.php settings.php
- chmod 664 settings.php
- chown geoff:apache settings.php
- mkdir files
- chown -R geoff:apache ./files
- chcon -Rv --type httpd_sys_rw_content_t ./files/
- Start Firefox and browse to http://localhost/
- Follow the Drupal installer
- Once finished we need to secure settings.php
- chmod 644 settings.php
- chcon -v --type httpd_sys_content_t ./settings.php
- Load Applications -> Sundry -> Firewall
• select the "public" zone
• check http and https
• check ftp if you use this
• change the Configuration to "Permanent"
• select the "public" zone
• check http and https
• check ftp if you use this
• exit, saving is automatic, this is done twice to update the current config and the persisted config