{"id":992,"date":"2013-01-27T14:26:23","date_gmt":"2013-01-27T14:26:23","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=992"},"modified":"2022-06-03T03:52:23","modified_gmt":"2022-06-03T08:52:23","slug":"script-install-wordpress-on-a-debianubuntu-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/","title":{"rendered":"Script: Install WordPress on a Debian\/Ubuntu VPS"},"content":{"rendered":"
<\/div>

\"\"Previously we explained how to install WordPress on a Debian VPS<\/a>. Also you can install WordPress on Debian<\/a> or Ubuntu VPS<\/a> in an easier way, using the script provided in this article. This script will create a MySQL database, will download and configure the latest WordPress version and create Apache virtual host for you automatically. All you need to do is to create a file on your WordPress VPS<\/a> with the content shown below, make the file executable, execute it and enter a few parameters.<\/p>\n

<\/p>\n

Create a new file and paste the script:<\/p>\n

# nano wpinstall<\/pre>\n
#!\/bin\/bash\n#\n# Install WordPress on a Debian\/Ubuntu VPS\n#\n\n# Create MySQL database\nread -p \"Enter your MySQL root password: \" rootpass\nread -p \"Database name: \" dbname\nread -p \"Database username: \" dbuser\nread -p \"Enter a password for user $dbuser: \" userpass\necho \"CREATE DATABASE $dbname;\" | mysql -u root -p$rootpass\necho \"CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$userpass';\" | mysql -u root -p$rootpass\necho \"GRANT ALL PRIVILEGES ON $dbname.* TO '$dbuser'@'localhost';\" | mysql -u root -p$rootpass\necho \"FLUSH PRIVILEGES;\" | mysql -u root -p$rootpass\necho \"New MySQL database is successfully created\"\n\n# Download, unpack and configure WordPress\nread -r -p \"Enter your WordPress URL? [e.g. mywebsite.com]: \" wpURL\nwget -q -O - \"http:\/\/wordpress.org\/latest.tar.gz\" | tar -xzf - -C \/var\/www --transform s\/wordpress\/$wpURL\/\nchown www-data: -R \/var\/www\/$wpURL && cd \/var\/www\/$wpURL\ncp wp-config-sample.php wp-config.php\nchmod 640 wp-config.php\nmkdir uploads\nsed -i \"s\/database_name_here\/$dbname\/;s\/username_here\/$dbuser\/;s\/password_here\/$userpass\/\" wp-config.php\n\n# Create Apache virtual host\necho \"\nServerName $wpURL\nServerAlias www.$wpURL\nDocumentRoot \/var\/www\/$wpURL\nDirectoryIndex index.php\n\nOptions FollowSymLinks\nAllowOverride All\n\nErrorLog ${APACHE_LOG_DIR}\/error.log\nCustomLog ${APACHE_LOG_DIR}\/access.log combined\n\" > \/etc\/apache2\/sites-available\/$wpURL\n\n# Enable the site\na2ensite $wpURL\nservice apache2 restart\n\n# Output\nWPVER=$(grep \"wp_version = \" \/var\/www\/$wpURL\/wp-includes\/version.php |awk -F\\' '{print $2}')\necho -e \"\\nWordPress version $WPVER is successfully installed!\"\necho -en \"\\aPlease go to http:\/\/$wpURL and finish the installation\\n\"<\/pre>\n

Make the script executable:<\/p>\n

# chmod +x wpinstall<\/pre>\n

Execute the script:<\/p>\n

# .\/wpinstall<\/pre>\n\n\n

For updates, you can also read our post on How to Install WordPress with Nginx on Debian 10<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"

Previously we explained how to install WordPress on a Debian VPS. Also you can install WordPress on Debian or Ubuntu … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":1145,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1710,1700,5,1698],"tags":[56,149,48,1152,58,59,148],"yoast_head":"\nScript: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting<\/title>\n<meta name=\"description\" content=\"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-27T14:26:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:52:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Script: Install WordPress on a Debian\/Ubuntu VPS\",\"datePublished\":\"2013-01-27T14:26:23+00:00\",\"dateModified\":\"2022-06-03T08:52:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\"},\"wordCount\":125,\"commentCount\":15,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png\",\"keywords\":[\"bash\",\"blog\",\"debian\",\"rosehosting\",\"script\",\"ubuntu\",\"wordpress\"],\"articleSection\":[\"CMS, CRM, ERP\",\"Debian\",\"Scripts\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\",\"name\":\"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png\",\"datePublished\":\"2013-01-27T14:26:23+00:00\",\"dateModified\":\"2022-06-03T08:52:23+00:00\",\"description\":\"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png\",\"width\":\"200\",\"height\":\"200\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Script: Install WordPress on a Debian\/Ubuntu VPS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting","description":"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/","og_locale":"en_US","og_type":"article","og_title":"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting","og_description":"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2013-01-27T14:26:23+00:00","article_modified_time":"2022-06-03T08:52:23+00:00","og_image":[{"width":"200","height":"200","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png","type":"image\/png"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Script: Install WordPress on a Debian\/Ubuntu VPS","datePublished":"2013-01-27T14:26:23+00:00","dateModified":"2022-06-03T08:52:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/"},"wordCount":125,"commentCount":15,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png","keywords":["bash","blog","debian","rosehosting","script","ubuntu","wordpress"],"articleSection":["CMS, CRM, ERP","Debian","Scripts","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/","url":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/","name":"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png","datePublished":"2013-01-27T14:26:23+00:00","dateModified":"2022-06-03T08:52:23+00:00","description":"Script: Install WordPress on a Debian\/Ubuntu VPS - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/10\/install-wordpress.png","width":"200","height":"200"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/script-install-wordpress-on-a-debianubuntu-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Script: Install WordPress on a Debian\/Ubuntu VPS"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/992"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=992"}],"version-history":[{"count":1,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/992\/revisions"}],"predecessor-version":[{"id":36705,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/992\/revisions\/36705"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/1145"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}