So. Drupal, eh? Scroll down for the install info. [This is where I ramble.] You want to discover : what it's all about? what's the fuss? why do people think it's so great? how can I leverage it to make a [certain] website? is it really that hard? Or maybe, you tried it before - and then said it's too complicated. Well. yeah.  The truth of it is : Drupal was never easy. OK. by today's standard maybe. I started Drupal when it was version 5. Yes that's right Drupal 5. Don't laugh. It seemed even complicated back then. Simple things like pulling all the contents out of a directory and moving it up one folder, including the .htaccess and non movable files. Or adjusting permissions and renaming the settings file.  Drupal is fantastic software that can be leveraged into many great things. It is developer centric. It can be a challenge to get started. But the benefits of learning it are highly beneficial. Fast forward to 2021 or whatever year it is. The time of Git, Github, Composer, still Drush, PHP version [?], different databases to choose from, you'd think it all just got easier right?? Well, cough *0<-- , huh-em, let's not get too far ahead of ourselves shall we? Ok. This article is here to : Either help beginners jump through some of the hoops of installing modern day Drupal. Version 8 or 9. OR, people who have experience with web development and want to install Drupal, OR, people who have done it before but might find some worthwhile info or be able to forward to a friend co-worker on how to install Drupal. But the main reason for this post is hopefully to fill in some of the blanks, or pieces of information missing, or guide you through the install. Let's jump right into it. First things first. What version of Drupal? What or where are you at with your current standing with a Drupal website? Do you have a site existing? What are you building? Drupal 7 migration maybe more on that later. If you plan on building something that has a LOT of functionality within the website, i.e., a social media type website that communicates between users, uploads videos, is more like an application than a basic website the answer is Drupal 8. Migrate to 9. As of this post. If it's just a simple website less requirements: Drupal 9. Always remember: There's always more that one way to skin a cat. Meaning, there are many ways of doing something. Some harder, some easier, but hopefully they get the same objective done. But in short there are actually 3 major hurdles in installing Drupal. You may not know that walking into it. Those three major steps are: 1. Installing a local environment (or server) to run Drupal (and having it configured right, including php and memory limits.) Meaning a database, PHP, and the interfaces that make them communicate together. Otherwise, well, you can run the program. 2. Installing Composer on your computer properly (and having it configured right to run.) and Last, 3. Installing Drupal (and yes, having it configured right to run.) These are the three hurdles you must get past to install Drupal. Taking it one stage at a time and working through it will get you there. The simplest way to start with Drupal is to install it on your computer. It may not be simple. But by doing this you can alter, change, customize it, and experiment with it. You don't need server admin privileges or a lot of server hosting resources to do it. The other simplest way is to just have a domain name or hosting, place the zip file in the web directory, unzip, move all the files up one directory back into the web directory, start a database, browse to the directory through a browser and walk through the installer. [not recommended] OK. So. To install Drupal on your computer you are going to need MAMP or XAMP or Bitnami or some basic LAMP stack installer. Links below but if you are starting out I suggest you pick one that is easiest to install. If you are advanced, you can run a Docker type local install called Lando or DDEV. Or install with a Image file for Docker and Drupal. Google those for more info. The easiest way is a basic LAMP stack using MAMP or XAMP or some basic program that installs and runs PHP and a database required to run Drupal. Work with one of those and you can go from there. MAMP or XAMP is a basic LAMP stack. Apache, MySQL, PHP. The reason I say use these is they are less complicated to set up. https://www.mamp.info/en/mamp/mac/ Note: Whatever you do - DO NOT install MAMP PRO! Make sure you install the MAMP FREE version. MAMP is available also for Windows. OR  XAMP https://www.apachefriends.org/index.html Walk through the installation of these. OK This is where the install information really comes in, sorry for rambling ... IMPORTANT: TWO THINGS: DRUPAL AND COMPOSER TAKE EXTREME AMOUNTS OF MEMORY AND HIGH VERSIONS OF PHP. PLEASE MAKE A NOTE OF IT. OTHERWISE, YOU ARE GOING TO RUN INTO PROBLEMS PERIOD. ALSO. IN PRODUCTION OR HOSTING ENVIRONMENTS YOU ARE GOING TO NEED TO UP THE MEMORY SETTING AND HAVE SOME CONTROL OVER THINGS LIKE PHP MODULES ETC. ALSO IF YOU WORK WITH A DOCKER SET UP BE AWARE OF THE SYSTEM REQUIREMENTS TO RUN IT. NOW. After installing either MAMP or XAMP or whatever you choose as a local PHP environment to run Drupal. Make sure you choose the HIGHEST php version available. start your web servers in MAMP or XAMP. Go to a terminal window: Type in [ php --ini ] The second line will tell you where your current running php.ini file is located. Go to or cd to that folder and file in Terminal and edit the Memory Limit: Put in 2G or -1. IMPORTANT. Make sure it saves. Then Find in the same file [OPCACHE] Make sure you take out the ; semicolon to enable it. ALSO. Find in the php.ini file: APCu. Again. Take out the semicolon ; and enable it. These are extensions that need be enabled. OPCACHE and ACPu. RESTART THE SERVER. [Turn off the server turn on the server or restart it.] or the command. Now. Choice 1: download the latest version of 8 or 9 in a zip file put in your web root folder maybe htdocs. Add a database. Walk through the web installer. Go to Extend in the Admin bar [add new modules] individually. Work your way from here. Choice 2: install with Composer. [kinda the recommended way] Composer is pushed as the de facto way to install Drupal. It's easy right? Not exactly, especially people who don't normally install websites or use Composer. This INFO will save you HEADACHES. IMPORTANT: MAKE SURE YOU INSTALL  COMPOSER  VERSION 1 ! NOT COMPOSER 2! SO. If you have Composer 2 already installed you MAY want to uninstall and reinstall Version 1. That's what I had to do. Drupal does not like Version 2 at the time of this posting. If you do not or have not installed Composer before, let's install it. Download version 1.10.22   https://getcomposer.org/download/1.10.22/composer.phar Note this link is for Composer 1. Go into terminal and go to the directory where it downloaded a single file called composer.phar Type :

mv composer.phar /usr/local/bin/composer

In Terminal type: php composer-setup.php --version=1.10.22 Composer will go through it's install process with lines of progress. Hopefully, it ran through it's course with no errors or did not stop it's finalization. If it does it usually spits out an error. If it does you are going to have to fix those errors and read up a bit more on installing Composer. Just look at the links below, hopefully they might help. OK. Now to find out if you successfully installed Composer Type:

composer --version

For more information on Composer go here https://getcomposer.org/doc/00-intro.md For more information on how to install Composer on a Mac go here: https://www.codegrepper.com/code-examples/shell/composer+mac For more information on how to install Composer on Windows go here: https://www.codegrepper.com/code-examples/shell/installer+composer+windows+10

Just remember - do not install the latest release Version 2. That's my suggestion until they migrate to version 2, otherwise you are going to run into problems.

NEXT. FINALLY INSTALL DRUPAL. Go here: https://github.com/drupal/recommended-project Click on the green Code button click download ZIP and place that file in your web root (probably htdocs www or public_html.) Unzip it. Go to that folder (your web root where you put the unzipped file in Terminal.) Then in the terminal Type for Drupal 8: composer create-project drupal/recommended-project:8.9.18 drupal For Drupal 9 just Type: composer create-project drupal/recommended-project drupal If everything is in check, composer will install the version of Drupal you specified along with everything in it's proper place for now. A folder called 'drupal'. Open a browser. Go to localhost:8888/drupal/web/ or your localhost URL plus add drupal/web/ to run Drupal in your web browser (see reference from MAMP or XAMP.) Walk through the steps to connect your database. PRO TIP: If you want to move all your files and folders up one level, you can go to or cd to the directory where your install is and Type: mv * .[^.]* .. This will move your entire Drupal installation up one directory. For example your install is in /htdocs/drupal/ and you want your Drupal install under just htdocs. To install Modules for Drupal or Themes: Go to the htdocs or www or public_html  directory and find your 'drupal' folder or folder you installed Drupal in and Type: composer require drupal/[module or theme name] For example: composer require drupal/token PRO TIP: You can add all your modules at once by typing in: composer require drupal/module-name drupal/module-name drupal/module-name Just put 'composer require' then after that 'drupal/then the name of the module based on drupal.org's last url name. Here are a list of "add-ons" you might want to install on your new Drupal site: composer require drupal/ctools drupal/token drupal/pathauto drupal/metatag drupal/webform drupal/redirect drupal/captcha drupal/simple_sitemap drupal/embed drupal/imce drupal/backup_migrate A couple more to consider and look into but not necessary: drupal/redirect_after_login    drupal/ultimate_cron    drupal/entity You might want to look into tightening up permissions on say settings.php and tucking everything in for your install. Possibly go over everything make sure you are not missing anything. OK. Don't you just love Composer? hahahahah. I knew it. Don't forget, something that is not suppose to go wrong, almost surely does. So get on Google and Drupal.org, ask questions, or post your errors and bugs. Installing Drupal with Composer, or sometimes even just Composer, can seem daunting. Having a step by step insight on what to do can help. Yes. Chances are you might run into problems, or get errors. Or maybe just miss something. But it is doable. Look for answers, take your time, and work through issues. Once you have it working or find a way that works best for you, it will start to make more sense. Maybe next we'll talk about getting your Drupal install off of your local computer and onto a domain name [mywebsite.com] or on the internet/cloud. Footnote: You can install Drupal all your modules etc with Drush or manually, then it is possible to convert an existing install beyond that to work with Composer. It's a bit tricky but doable. Composer and tracking dependencies for installation are nice. If you have a production environment that just works based on a combination of integrated code or versions that you know work, manually overseeing that isn't crazy as most may think. Yes, I did actually say that. Updates, patches, upgrades can easily break things so be careful. Pro tip: fwiw installing the module backup and migrate early on is a good practice and creating a backup, or manually backing things up is a good idea. It's not entirely uncommon to run into a problem or get unwanted errors even early in development. If you want to have a starting point, save it. Backup and Migrate is a minimum.
zip -r nameincludethedate.zip fullpathtothedirectorytozip
Manually backing up the files into a downloadable zip file along with a export of the database is my personal recommendation especially if you are getting to the point where your development is important. This is better than backupandmigrate and at lease you have a backed up restarting point. Although, Git Github and repository production is present, I still vote for 1 for the old standby. I won't state the reasons here. That's another article. If you update a module, or even let alone, install a module and your website breaks... , yeah well.. having options are a value. NOTE: (you don't need to read this section unless you encounter the following:) In most cases, if your website freezes, those or the last modules should be pulled uninstalled from the modules folder, and your database cache needs to be cleared. The way to uninstall modules in Composer is: composer remove drupal/[modulename] One way of doing clearing your cache is installing Drush. Composer will install that.
composer require --dev drush/drush
./vendor/bin/drush --version
# > Drush Commandline Tool 10.2.1
Install the Drush launcher:
OSX:
curl -OL https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar
Linux:
wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar
Make downloaded file executable:
chmod +x drush.phar

Move drush.phar to a location listed in your $PATH, and rename to drush:
sudo mv drush.phar /usr/local/bin/drush
Windows users: create a drush.bat file in the same folder as drush.phar with the following lines. This gets around the problem where Windows does not know that .phar files are associated with php:
@echo off
php "%~dp0\drush.phar" %*
Finally, use drush --version to verify it worked. Now run Drush to rebuild your cache: drush updb -y and drush cr for Drupal 8. Try in your browser your website again to see if it's working.

That pretty much completes our overview of Drupal 8 install. I hope this helps in some way. Let me know if you find any good missing gaps to include or you found this helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *