{"id":15940,"date":"2022-01-14T07:08:46","date_gmt":"2022-01-14T07:08:46","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15940"},"modified":"2026-03-10T09:29:24","modified_gmt":"2026-03-10T09:29:24","slug":"how-to-install-wordpress-on-ubuntu","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-install-wordpress-on-ubuntu\/","title":{"rendered":"How to install WordPress on Ubuntu automatically and with the LAMP stack"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>WordPress hosting service lets you quickly set up the content management system (CMS) to create a website. While such a solution is easy to use, the web host usually limits you from choosing the web server and database.<\/p><p>If you&rsquo;re looking for extensive customization, you should install WordPress on a virtual private server (VPS) instead. This hosting type lets users choose any software to set up the CMS and tailor the server settings to their needs.<\/p><p>To help you get started, this tutorial will explain how to install WordPress on Ubuntu. We will provide two methods: automatically using the Hostinger VPS template and manually with commands.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites-for-installing-wordpress-on-ubuntu\">Prerequisites for installing WordPress on Ubuntu<\/h2><p>Before installing WordPress, ensure your VPS is running Ubuntu since the commands differ for another Linux operating system.<\/p><p>To avoid incompatibility issues, <a href=\"\/ca\/tutorials\/how-to-check-ubuntu-version\/\">check your Ubuntu version<\/a> and ensure you are running<strong> 22.04<\/strong> or later. Your VPS should also support software required for WordPress, like a web server and database.<\/p><p>Since WordPress is relatively lightweight, you can use an entry-level server like Hostinger&rsquo;s KVM 1 <a href=\"\/ca\/vps-hosting\">VPS platform<\/a>. Starting at <strong>CA$ 9.09\/month<\/strong>, it offers<strong> 1 vCPU<\/strong> core, <strong>4 GB <\/strong>of RAM, and <strong>50 GB<\/strong> of NVMe SSD storage.<\/p><p>Hostinger VPS also supports Ubuntu and other software necessary for WordPress installation. Moreover, our operating system templates let you configure the CMS in one click. We will explain how to do so in the following section. <\/p><p>After purchasing a VPS, ensure you have <a href=\"\/ca\/tutorials\/dns\/how-to-point-domain-to-vps\/\">pointed a domain name to your VPS<\/a> since we will use it to access the WordPress admin panel and finish the setup process.<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ca\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-install-wordpress-on-ubuntu-automatically\">Install WordPress on Ubuntu automatically<\/h2><p>Hostinger VPS users can easily install WordPress via their web browser using the pre-configured <a href=\"https:\/\/support.hostinger.com\/en\/collections\/2797407-vps-os-and-templates?_gl=1*10bmo1*_gcl_aw*R0NMLjE3MjUzNTc4MDIuQ2p3S0NBanc1OXEyQmhCT0Vpd0FLYzBpaldtY212MFNYQWxtV29ndDVmbFJsX2hyU0RyTFM4VmNTRTRZZ1UzbW00RlpoWHVpSGpCV0Nob0N5ZThRQXZEX0J3RQ..*_gcl_au*MjA0ODEwMDA4NC4xNzI2NjU0MzU3\" target=\"_blank\" rel=\"noopener\">OS template<\/a>. This method is suitable for beginners since it doesn&rsquo;t use commands, making the process safer and simpler.<\/p><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583232-how-to-back-up-or-restore-a-vps\" target=\"_blank\" rel=\"noopener\">Back up your VPS data<\/a> before installing an OS template since it will wipe all your data permanently. However, this step is unnecessary if you are using a new, empty server.\n            <\/p><\/div>\n\n\n\n<\/p><p>Here&rsquo;s how to do so:<\/p><ol class=\"wp-block-list\">\n<li>Log in to <strong>hPanel <\/strong>and click <strong>VPS<\/strong> on the sidebar.<\/li>\n\n\n\n<li>Click <strong>Manage<\/strong> on the VPS you want to install WordPress.<\/li>\n\n\n\n<li>Navigate to the side panel &rarr; <strong>OS &amp; Panel <\/strong>&rarr; <strong>Operating System<\/strong>.<\/li>\n\n\n\n<li>In the operating system configuration menu, select <strong>Applications<\/strong> and choose <strong>WordPress<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58ff7c6ed15\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58ff7c6ed15\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"465\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/01\/the-wordpress-template-on-hpanel.png\/w=1024,h=1024,fit=scale-down\" alt=\"The WordPress template on hPanel\" class=\"wp-image-119967\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Click <strong>Change OS<\/strong> to confirm.<\/li>\n\n\n\n<li>Check the confirmation box to acknowledge that the installation will wipe your data. Click <strong>Next<\/strong>.<\/li>\n\n\n\n<li>Enter a new <strong>Panel password<\/strong> and click <strong>Confirm<\/strong>.<\/li>\n<\/ol><p>Wait until the installation process is finished, which should take a few minutes. That&rsquo;s it! You can now access the WordPress admin area by visiting this address. Remember to replace the VPS hostname with the actual value:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/your-vps-hostname\/wp-admin<\/pre><p>If the address doesn&rsquo;t work, <a href=\"\/ca\/tutorials\/how-to-edit-hosts-file\/\">edit your system&rsquo;s hosts file<\/a> and add your VPS IP address with its hostname. If you have connected a domain, you can also access the page with the following address:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/domain.tld\/wp-admin&amp;<\/pre><p>Note that you can&rsquo;t choose the web server and database solution if you configure WordPress using Hostinger&rsquo;s OS template.<\/p><h2 class=\"wp-block-heading\" id=\"h-install-wordpress-on-ubuntu-using-a-lamp-stack\">Install WordPress on Ubuntu using a LAMP stack<\/h2><p>Installing WordPress manually using commands is suitable if you need specific software for your website. For example, if you want to use Apache and MySQL, <a href=\"\/ca\/tutorials\/how-to-install-lamp-on-ubuntu\/\">set up the LAMP stack on your Ubuntu server<\/a>.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\">Hostinger VPS also offers a template that automates Ubuntu and LAMP stack setup, which you can install from the same menu as the WordPress one.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\">1. Connect to your server and create an account<\/h3><p>Before installing WordPress, connect to your VPS <a href=\"\/ca\/tutorials\/how-to-use-putty-ssh\/\">using the PuTTY SSH client<\/a> and create a new user. Alternatively, Hostinger users can easily access their system&rsquo;s command-line interface via a web browser using the <strong>Browser terminal<\/strong>.<\/p><p>You will connect as <strong>root<\/strong> by default. However, using this account to manage your VPS can be unsafe since it can run any command without confirmation, including those that can alter important system settings.<\/p><p>Using a new user helps minimize the risk since it requires the <strong>sudo<\/strong> prefix and password to execute commands. To create one, run the following and replace username with your desired value:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">adduser username<\/pre><p>Add the user into the <strong>sudoers<\/strong> group to grant the superuser privilege:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">usermod -a -G sudo username<\/pre><p>Switch from <strong>root <\/strong>to the new user using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">su username<\/pre><p>Enter <strong>cd <\/strong>to return to your system&rsquo;s main directory.<\/p><h3 class=\"wp-block-heading\">2. Install WordPress dependencies<\/h3><p>Once logged in to your server as a superuser, update your system repository to ensure you get the latest version of all packages. Here&rsquo;s the command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt update<\/pre><p>Now, install WordPress&rsquo;s dependencies &ndash; packages required for the platform to function properly. Here is the list:<\/p><ul class=\"wp-block-list\">\n<li><strong>Apache <\/strong>&ndash; a web server that takes and processes user requests, enabling your WordPress instance to be accessible online.<\/li>\n\n\n\n<li><strong>MySQL <\/strong>&ndash; a database for storing your WordPress data.<\/li>\n\n\n\n<li><strong>PHP and its modules <\/strong>&ndash; a programming language that interprets WordPress and enables WordPress to run on your server.<\/li>\n<\/ul><p>To install all the dependencies, run the following command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install apache2 ghostscript libapache2-mod-php mysql-server php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip<\/pre><h3 class=\"wp-block-heading\" id=\"h-3-download-and-install-wordpress\">3. Download and install WordPress<\/h3><p>Now we can proceed with the WordPress installation. To begin, create a folder called \/srv\/www using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo mkdir -p \/srv\/www<\/pre><p>This folder will contain all your WordPress website files. Now, assign your web server as the folder owner so the data is accessible online. Here&rsquo;s the command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo chown www-data: \/srv\/www<\/pre><p>Then, download and extract the WordPress installation package using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl https:\/\/wordpress.org\/latest.tar.gz | sudo -u www-data tar zx -C \/srv\/www<\/pre><h3 class=\"wp-block-heading\">4. Configure the Apache web server<\/h3><p>Set up your Apache web server so it can serve the WordPress files online. To do so, create a configuration file <a href=\"\/ca\/tutorials\/how-to-install-and-use-nano-text-editor\/\">using the nano file editor<\/a>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano \/etc\/apache2\/sites-available\/wordpress.conf<\/pre><p>Then, copy and paste the following configuration into the file. Once finished, hit<strong> Ctrl<\/strong> +<strong> X<\/strong>, <strong>Y<\/strong>, and <strong>Enter <\/strong>to save the changes.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;VirtualHost *:80&gt;\n    DocumentRoot \/srv\/www\/wordpress\n    &lt;Directory \/srv\/www\/wordpress&gt;\n        Options FollowSymLinks\n        AllowOverride Limit Options FileInfo\n        DirectoryIndex index.php\n        Require all granted\n    &lt;\/Directory&gt;\n    &lt;Directory \/srv\/www\/wordpress\/wp-content&gt;\n        Options FollowSymLinks\n        Require all granted\n    &lt;\/Directory&gt;\n&lt;\/VirtualHost&gt;<\/pre><p>Enable the WordPress site configuration so Apache can serve it by running these commands:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo a2ensite wordpress<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo a2enmod rewrite<\/pre><p>Next, disable the default Apache site so your web server will display the correct WordPress page by entering this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo a2dissite 000-default<\/pre><p>Refresh Apache to ensure all changes are applied properly:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo service apache2 reload<\/pre><h3 class=\"wp-block-heading\">5. Set up the MySQL database<\/h3><p>Set up a new MySQL database for your WordPress site to store and fetch user data. To do so, enter the SQL shell using the default root account by running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo mysql -u root<\/pre><p>Then, create a new database. In this tutorial, we will call it <strong>wordpress:<\/strong><\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE DATABASE wordpress;<\/pre><p>Set up a new user for the wordpress database. Remember to replace <strong>your-password <\/strong>with the actual credential:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE USER wordpress@localhost IDENTIFIED BY 'your-password';<\/pre><p>Grant the user permission to access and modify the database by running the following:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;<\/pre><p>Flush the database privileges to apply the changes:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">FLUSH PRIVILEGES;<\/pre><p>Exit the SQL shell using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">quit<\/pre><h3 class=\"wp-block-heading\">6. Configure phpMyAdmin<\/h3><p>In addition to MySQL, we will also install phpMyAdmin, a database administration panel that offers a graphical user interface to simplify management tasks. To do so, run:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install phpmyadmin<\/pre><p>Hit <strong>Space <\/strong>to check Apache as your web server and confirm using <strong>Enter<\/strong>. Then, set the phpMyAdmin panel password. After completing the configuration, enable the <strong>PHP Mbstring <\/strong>extension using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo phpenmod mbstring<\/pre><p>Restart Apache to apply the changes using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl restart apache2<\/pre><p>Now, log in to MySQL root account by entering the following. Enter the password you created during the phpMyAdmin installation:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo mysql -u root -p<\/pre><p>Then, run the following command to grant phpMyAdmin privilege to enable database connection:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost';<\/pre><p>Flush the privileges to refresh the configuration and enter <strong>quit <\/strong>to close the MySQL shell. To check whether phpMyAdmin is configured correctly, enter the following address in your web browser:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/domain.tld\/phpmyadmin<\/pre><p>Remember to replace the domain with the actual value. On the login page, enter phpMyAdmin as the username and use the password you set during the panel installation.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58ff7c70b7c\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58ff7c70b7c\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"906\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/the-phpmyadmin-login-page.png\/w=1024,h=1024,fit=scale-down\" alt=\"The phpMyAdmin login page\" class=\"wp-image-109969\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong><br>\nIf you encounter the &ldquo;URL not found&rdquo; error, run <strong>sudo dpkg-reconfigure phpmyadmin<\/strong> to rerun the installation and tick Apache by pressing space. Meanwhile, ensure you assign the correct user to the MySQL database if facing login issues.\n            <\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\">7. Complete the WordPress setup wizard<\/h3><p>The last step is to complete the WordPress setup from your web browser. Visit the following address with <strong>domain.tld <\/strong>being your actual domain name:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/domain.tld\/wp-admin<\/pre><p>Click <strong>Let&rsquo;s Go<\/strong>, and WordPress will ask you to enter information about your database. Enter the credentials you have created in the previous steps, but leave out the <strong>host <\/strong>and<strong> prefix<\/strong> fields. Click <strong>Submit <\/strong>once finished.<\/p><p>In the next screen, hit <strong>Run the installation<\/strong>. Enter information about your WordPress <strong>username<\/strong>, <strong>password<\/strong>, <strong>site title<\/strong>, and <strong>admin email address<\/strong>. Ensure you uncheck the &ldquo;<strong>Discourage search engines from indexing this site<\/strong>&rdquo; to make your website discoverable on the search engine result pages.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58ff7c722e1\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58ff7c722e1\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"881\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/site-information-forms-in-the-wordpress-installation-wizard.png\/public\" alt=\"Site information forms in the WordPress installation wizard\" class=\"wp-image-109970\"  sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Click <strong>Install WordPress<\/strong> to proceed with the setup. Once finished, click <strong>Log in<\/strong> on the confirmation screen and enter your account credentials to access the WordPress dashboard. That&rsquo;s it! You can now start creating your website using the CMS.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Hosting WordPress on a VPS provides more flexibility over dedicated CMS hosting since you can choose different web servers and database solutions. However, installing it can be difficult due to the need for commands.<\/p><p>Hostinger VPS users can easily install WordPress on an Ubuntu server without commands by selecting the<strong> WordPress <\/strong>template in <strong>hPanel<\/strong>&rsquo;s operating system menu. Then, visit the VPS hostname followed by <strong>\/wp-admin<\/strong> to access the dashboard.<\/p><p>Another method is to configure WordPress with LAMP stack using commands. After connecting to your server via SSH, install all the dependencies, including the Apache web server and MySQL database.<\/p><p>Once the web stack is set, download the WordPress installation and unpack it. Configure Apache and visit your domain name followed by <strong>\/wp-admin<\/strong> to initiate the setup wizard.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-install-wordpress-on-ubuntu-faq\">How to Install WordPress on Ubuntu FAQ<\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1715851494183\"><h3 class=\"schema-faq-question\">Can I Install WordPress on Ubuntu Without Using the Command Line?<\/h3> <p class=\"schema-faq-answer\">Yes! Hostinger users can install WordPress on Ubuntu without commands using our operating system template. To do so, log in to <strong>hPanel <\/strong>and manage the VPS in question. Navigate to the operating system configuration menu and select the <strong>WordPress <\/strong>template.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1715851503097\"><h3 class=\"schema-faq-question\">How Do I Secure My WordPress Site on Ubuntu?<\/h3> <p class=\"schema-faq-answer\">Apply robust safety measures on your VPS, including <a href=\"\/ca\/tutorials\/how-to-configure-firewall-on-ubuntu-using-ufw\/\">enabling a firewall<\/a>, installing SSL, and setting up <strong>Fail2Ban<\/strong>. To <a href=\"\/ca\/tutorials\/how-to-secure-wordpress\/\">secure WordPress<\/a>, install plugins like Wordfence, avoid untrusted extensions, regularly update the core files, and set up a blocklist.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1715851507007\"><h3 class=\"schema-faq-question\">How Can I Access My WordPress Site After Installation?<\/h3> <p class=\"schema-faq-answer\">To access your WordPress site after installation, simply visit your VPS domain in a web browser. If you haven&rsquo;t completed the setup wizard, add <strong>\/wp-admin<\/strong> at the end of the URL. If you have finished the setup, using<strong> \/wp-admin <\/strong>will open the WordPress dashboard page.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>WordPress hosting service lets you quickly set up the content management system (CMS) to create a website. While such a solution is easy to use, the web host usually limits you from choosing the web server and database. If you&rsquo;re looking for extensive customization, you should install WordPress on a virtual private server (VPS) instead. [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-install-wordpress-on-ubuntu\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Install WordPress on Ubuntu - 2 Confirmed Methods","rank_math_description":"Check this article to learn how to install WordPress on Ubuntu automatically using Hostinger\u2019s VPS template and manually with a LAMP stack.","rank_math_focus_keyword":"install wordpress ubuntu","footnotes":""},"categories":[22701,22699],"tags":[],"class_list":["post-15940","post","type-post","status-publish","format-standard","hentry","category-pre-installed-applications","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":1},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/como-instalar-wordpress-ubuntu\/","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/instalar-wordpress-ubuntu\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-install-wordpress-on-ubuntu\/","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/instalar-wordpress-ubuntu\/","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/instalar-wordpress-ubuntu\/","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/instalar-wordpress-ubuntu\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-instalar-wordpress-ubuntu\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=15940"}],"version-history":[{"count":42,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15940\/revisions"}],"predecessor-version":[{"id":138417,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15940\/revisions\/138417"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=15940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=15940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=15940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}