{"id":267,"date":"2025-11-30T21:36:17","date_gmt":"2025-11-30T21:36:17","guid":{"rendered":"https:\/\/edk-tech.net\/?p=267"},"modified":"2025-11-30T21:36:17","modified_gmt":"2025-11-30T21:36:17","slug":"install-drupal-cms-in-root-directory","status":"publish","type":"post","link":"https:\/\/edk-tech.net\/?p=267","title":{"rendered":"Install Drupal CMS in Root Directory"},"content":{"rendered":"<html><body><p><style>.siteseo-toc-wrapper { padding: 20px; border: 1px solid #a2a9b1; background-color: #f8f9fa;}.siteseo-toc-wrapper p { display:flex; align-items:center; gap: 10px; font-size: 1.5rem; font-weight: 500; margin: 0 0 10px 0;}.siteseo-toc-wrapper > ol { margin: 0; padding: 0;}.siteseo-toc-wrapper p>label { font-weight: 400; font-size: 0.9rem;}#siteseo-toc-toggle~span { cursor: pointer;}#siteseo-toc-toggle:checked~.siteseo-toc-hide,p:has(#siteseo-toc-toggle:checked) ~ ol { display: none;}#siteseo-toc-toggle:not(:checked) ~ .siteseo-toc-hide{ display: inline;}#siteseo-toc-toggle:not(:checked) ~ .siteseo-toc-show { display: none;}<\/style>\n\t\t\t<div class=\"siteseo-toc-wrapper\">\n\t\t\t<p>Table of Content <label for=\"siteseo-toc-toggle\">\n\t\t\t<input type=\"checkbox\" style=\"display:none;\" id=\"siteseo-toc-toggle\" name=\"siteseo-toc-toggle\"\/>\n\t\t\t[<span class=\"siteseo-toc-hide\">hide<\/span><span class=\"siteseo-toc-show\">show<\/span>]<\/label><\/p>\n\t\t\t<ol><ol><li><a href=\"#using-composer\">Using Composer<\/a><\/li><ol><li><a href=\"#access-your-server-via-ssh-and-navigate-to-the-directory-where-drupal-will-be-installed\">Access Your Server via SSH and Navigate to the Directory where Drupal Will be Installed<\/a><\/li><li><a href=\"#using-a-web-browser\">Using a web browser<\/a><\/li><li><a href=\"#move-the-web-directory-to-the-root-directory\">Move the &#039;web&#039; directory to the root directory<\/a><\/li><li><a href=\"#edit-composer-json\">Edit composer.json File<\/a><\/li><li><a href=\"#install-drupal\">Install Drupal<\/a><\/li><\/ol><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"using-composer\">Using Composer<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"access-your-server-via-ssh-and-navigate-to-the-directory-where-drupal-will-be-installed\">Access Your Server via SSH and Navigate to the Directory where Drupal Will be Installed<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In Command Line Interface, type: <code>ssh username@serverip -p yourportnumber<\/code>, replacing <em>username<\/em>, <em>serverip<\/em>, and <em>yourportnumber<\/em> with your specific credentials for your server,<\/li>\n\n\n\n<li>Once prompted for your password, type it or paste it,<\/li>\n\n\n\n<li>Once your SSH session has been authenticated, navigate to the directory where Drupal will be installed by using a command similar to the following: <code>cd path\/to\/your\/drupal\/directory<\/code>, or<\/li>\n\n\n\n<li>Make the directory with command: <code>mkdir directoryname<\/code>here.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"using-a-web-browser\">Using a web browser<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to drupal.org\/download and copy the provided composer command,<\/li>\n\n\n\n<li>Add the <code>--no-install<\/code> option,<\/li>\n\n\n\n<li>Your command should look similar to this: <code>composer create-project --no-install drupal\/cms<\/code>,<\/li>\n\n\n\n<li>Paste the command into your SSH command line interface.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"move-the-%25e2%2580%2598web%25e2%2580%2599-directory-to-the-root-directory\">Move the \u2018web\u2019 directory to the root directory<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>There should be a directory named, \u201ccms\u201d with some files and a folder called \u201cweb\u201d,<\/li>\n\n\n\n<li>Move all files and directories from \u201ccms\u201d folder to root directory: <code>mv cms\/* .\/<\/code>,<\/li>\n\n\n\n<li>Delete \u201ccms\u201d folder: <code>rmdir cms<\/code>,<\/li>\n\n\n\n<li>Move all files and directories from web folder to root directory: <code>mv web\/* .\/<\/code>,<\/li>\n\n\n\n<li>Delete web folder: <code>rmdir web<\/code>.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"edit-composer-json\">Edit composer.json File<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Type: <code>vi composer.json<\/code>,<\/li>\n\n\n\n<li>Type: <code>i<\/code> to enable insert mode,<\/li>\n\n\n\n<li>Find and change <code>web-root<\/code> and <code>installer-paths<\/code> directives from <em>web<\/em> directory to root directory.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\"drupal-scaffold\": {\n            \"locations\": {\n                \"web-root\": \"web\/\"\n            }\n        },       \n \"installer-paths\": {\n            \" web\/core\": [\"type:drupal-core\"],\n            \" web\/libraries\/{$name}\": [\"type:drupal-library\"],\n            \" web\/modules\/contrib\/{$name}\": [\"type:drupal-module\"],\n            \" web\/profiles\/contrib\/{$name}\": [\"type:drupal-profile\"],\n            \" web\/themes\/contrib\/{$name}\": [\"type:drupal-theme\"],\n            \".\/drush\/Commands\/contrib\/{$name}\": [\"type:drupal-drush\"],\n            \" web\/modules\/custom\/{$name}\": [\"type:drupal-custom-module\"],\n            \" web\/profiles\/custom\/{$name}\": [\"type:drupal-custom-profile\"],\n            \".\/recipes\/{$name}\": [\"type:drupal-recipe\"],\n            \"web\/themes\/custom\/{$name}\": [\"type:drupal-custom-theme\"]\n        },<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Change the above to:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\"drupal-scaffold\": {\n            \"locations\": {\n                \"web-root\": \".\/\"\n            }\n        },       \n \"installer-paths\": {\n            \".\/core\": [\"type:drupal-core\"],\n            \".\/libraries\/{$name}\": [\"type:drupal-library\"],\n            \".\/modules\/contrib\/{$name}\": [\"type:drupal-module\"],\n            \".\/profiles\/contrib\/{$name}\": [\"type:drupal-profile\"],\n            \".\/themes\/contrib\/{$name}\": [\"type:drupal-theme\"],\n            \".\/drush\/Commands\/contrib\/{$name}\": [\"type:drupal-drush\"],\n            \".\/modules\/custom\/{$name}\": [\"type:drupal-custom-module\"],\n            \".\/profiles\/custom\/{$name}\": [\"type:drupal-custom-profile\"],\n            \".\/recipes\/{$name}\": [\"type:drupal-recipe\"],\n            \".\/themes\/custom\/{$name}\": [\"type:drupal-custom-theme\"]\n        },<\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Press <code>Esc<\/code> key to exit insert mode,<\/li>\n\n\n\n<li>Type: <code>:wq<\/code> to save file and exit.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-drupal\">Install Drupal<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>For developer site, type: <code>composer install<\/code>.<\/li>\n\n\n\n<li>For production site, type: <code>composer install --no-dev<\/code>.<\/li>\n\n\n\n<li>Create your database.<\/li>\n\n\n\n<li>Run the interactive installer via a web browser.<\/li>\n\n\n\n<li>Follow the steps provided in the <strong>INSTALL.txt<\/strong> file located in the <strong>core<\/strong> directory to complete your setup and secure your site.<\/li>\n<\/ol>\n<\/body><\/html>","protected":false},"excerpt":{"rendered":"<p>Using Composer Access Your Server via SSH and Navigate to the Directory where Drupal Will be Installed Using a web browser Move the &#8216;web&#8217; directory to the root directory Edit composer.json File Install Drupal<\/p>\n","protected":false},"author":1,"featured_media":190,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[23,27],"tags":[37],"class_list":{"0":"post-267","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-knowledgebase","8":"category-web-development","9":"tag-drupal"},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/peQefU-4j","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/edk-tech.net\/index.php?rest_route=\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/edk-tech.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edk-tech.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edk-tech.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edk-tech.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=267"}],"version-history":[{"count":0,"href":"https:\/\/edk-tech.net\/index.php?rest_route=\/wp\/v2\/posts\/267\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/edk-tech.net\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/edk-tech.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edk-tech.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edk-tech.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}