Created
October 30, 2013 11:39
-
-
Save klan/7231249 to your computer and use it in GitHub Desktop.
How to set up a subdomain on a Linode server with a Drupal installation and a repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
• SSH to your server to start creating a subdomain (https://library.linode.com/hosting-website#sph_configuring-name-based-virtual-hosts) | |
• Go to ~/public/ | |
› mkdir -p sub.example.com/{public,log,backup} | |
› cd sub.example.com/public/ | |
› nano index.html | nano index.php | |
• Write 'Hello world' or whatever, we just need a html|php file to test with | |
› sudo nano /etc/apache2/sites-available/sub.example.com | |
• Paste and edit the following: | |
# domain: sub.example.com | |
# public: /home/[user]/public/sub.example.com/ | |
<VirtualHost *:80> | |
# Admin email, Server Name (domain name), and any aliases | |
ServerAdmin [email protected] | |
ServerName sub.example.com | |
ServerAlias www.sub.example.com | |
# Index file and Document Root (where the public files are located) | |
DirectoryIndex index.html index.php | |
DocumentRoot /home/[user]/public/sub.example.com/public | |
# Log file locations | |
LogLevel warn | |
ErrorLog /home/[user]/public/sub.example.com/log/error.log | |
CustomLog /home/[user]/public/sub.example.com/log/access.log combined | |
</VirtualHost> | |
• Save, then create symbolic link and restart Apache | |
› sudo a2ensite sub.plur.dk | |
› sudo service apache2 restart | |
• Go to https://manager.linode.com/dns/ and log in | |
• Choose your domain, and create a new A record, fill in hostname and IP | |
• Wait 15 min for nameserver, check that index.html|php is loaded | |
› cd ~/public/sub.example.com/public/ | |
› drush dl drupal | |
› cp -R drupal-7.??/* . | |
› rm -rf drupal-7.??/ | |
› cd sites/default/ | |
› mkdir files/ | |
› chmod a+w files/ | |
› cp default.settings.php settings.php | |
› chmod a+w settings.php | |
• Log in with mysql user and create db (https://library.linode.com/hosting-website#sph_creating-a-database) (http://www.pantz.org/software/mysql/mysqlcommands.html) | |
› mysql -u root -p (root password needs numbers, special-, lower- and uppercase-characters) | |
› create database example_projectname_drupal; | |
› grant all on example_projectname_drupal.* to 'klaus' identified by 'password'; | |
› flush privileges; | |
› quit; | |
• Go to site in browser to complete Drupal installation | |
› chmod a+w settings.php | |
• Using GitHub or BitBucket? Copy your key and add it on the website | |
› pbcopy < ~/.ssh/id_rsa.pub | |
› cd ~/public/sub.example.com/public | |
› git clone [email protected]:username/git-repo.git | |
› cp -R git-repo/.git .git | |
› cp git-repo/.gitignore . | |
› cp git-repo/README.md . | |
› git reset --hard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment