<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Achmad Dinofaldi Firmansyah</title>
    <description>The latest articles on DEV Community by Achmad Dinofaldi Firmansyah (@bangik).</description>
    <link>https://dev.to/bangik</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1012737%2F123e3866-e82a-4b2a-966c-de4a656b7a53.jpeg</url>
      <title>DEV Community: Achmad Dinofaldi Firmansyah</title>
      <link>https://dev.to/bangik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bangik"/>
    <language>en</language>
    <item>
      <title>Deploying a Static Front-End to AWS</title>
      <dc:creator>Achmad Dinofaldi Firmansyah</dc:creator>
      <pubDate>Sun, 02 Jul 2023 10:54:24 +0000</pubDate>
      <link>https://dev.to/bangik/deploying-a-static-front-end-to-aws-b9o</link>
      <guid>https://dev.to/bangik/deploying-a-static-front-end-to-aws-b9o</guid>
      <description>&lt;p&gt;Deploying a Vue static front-end to AWS is a straightforward process that allows you to showcase your VueJS application to anyone on the web. In this blog post, we will guide you through the step-by-step process of deploying your VueJS bundle to an AWS S3 bucket and configuring static hosting settings. Let's get started!&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 1: Creating an S3 Bucket
&lt;/h5&gt;

&lt;p&gt;To begin, navigate to your AWS console and access the S3 service. Once there, click on 'Create Bucket' to initiate the bucket creation process. Choose a unique name for your bucket, ensuring it is relevant to your project.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 2: Configuring Bucket Access
&lt;/h5&gt;

&lt;p&gt;To enable public access and allow anyone on the web to view your site, it is necessary to unblock all public access to the bucket. This ensures that the necessary permissions are set correctly. Create the new bucket after configuring the access settings.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 3: Uploading Bundled Files
&lt;/h5&gt;

&lt;p&gt;Select your newly created bucket and click on the 'Upload' button. This action will open a file upload dialog. Proceed to drag and drop all the bundled files from the 'dist' directory that was generated by VueJS during the build process. Confirm the upload of all the files.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 4: Enabling Static Hosting
&lt;/h5&gt;

&lt;p&gt;In the bucket's properties, scroll down until you find the static hosting settings. Edit the settings and enable hosting for your Vue static front-end. Additionally, set the index document to 'index.html', which serves as the entry point for your application.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 5: Configuring Bucket Permissions
&lt;/h5&gt;

&lt;p&gt;Navigate to the bucket's permissions (not properties) and edit the bucket policy to include the provided JSON code. This policy grants the necessary permissions for public read access to objects within the bucket. Make sure to replace 'Bucket-Name' in the code with the actual name of your bucket.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::Bucket-Name/*"
            ]
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 6: Testing the Deployment
&lt;/h5&gt;

&lt;p&gt;After completing all the previous steps, you will find an endpoint URL for your deployed Vue static front-end. To access it, go to your bucket properties and scroll down until you see the endpoint. Click on it to test your deployment and ensure that everything is working correctly.&lt;/p&gt;

&lt;p&gt;Deploying a Vue static front-end to AWS using an S3 bucket is a convenient way to make your application accessible to users on the web. By following the steps outlined in this blog post, you can easily configure the necessary settings and policies to ensure your VueJS application is deployed and hosted properly. Enjoy showcasing your Vue project to the world!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>fronted</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Deploying a Flask Application on AWS EC2</title>
      <dc:creator>Achmad Dinofaldi Firmansyah</dc:creator>
      <pubDate>Sat, 01 Jul 2023 11:14:42 +0000</pubDate>
      <link>https://dev.to/bangik/deploying-a-flask-application-on-aws-ec2-52k7</link>
      <guid>https://dev.to/bangik/deploying-a-flask-application-on-aws-ec2-52k7</guid>
      <description>&lt;p&gt;In this blog post, we will walk through the process of deploying a Flask application on an AWS EC2 instance. We will cover each step from setting up the environment to configuring Nginx as a reverse proxy. By following these steps, you will be able to successfully deploy your Flask application and make it accessible to the outside world.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 1: Update the System
&lt;/h5&gt;

&lt;p&gt;To ensure that our system has the latest package information, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command updates the package lists for upgrades and new installations.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 2: Install Python Virtual Environment
&lt;/h5&gt;

&lt;p&gt;To create an isolated Python environment for our project, we need to install the python3-venv package. Execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install python3-venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Python virtual environments allow us to manage dependencies and isolate our project's environment from the system Python installation.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 3: Clone or Create the Project Directory
&lt;/h5&gt;

&lt;p&gt;You have two options here. Either clone an existing project from GitHub using the git clone command, or create a new project directory using the mkdir command followed by the desired project name.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 4: Navigate to the Project Directory
&lt;/h5&gt;

&lt;p&gt;Change your current working directory to the project directory using the cd command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd project_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 5: Create a Virtual Environment
&lt;/h5&gt;

&lt;p&gt;Now, let's create a virtual environment for our project. Execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m venv venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a virtual environment named "venv" inside your project directory.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 6: Activate the Virtual Environment
&lt;/h5&gt;

&lt;p&gt;To activate the virtual environment, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;. venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once activated, your command prompt will reflect the virtual environment's name.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 7: Install Flask and Dependencies
&lt;/h5&gt;

&lt;p&gt;Next, we need to install Flask and any other project dependencies. Use either of the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install Flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command is used if you have a requirements.txt file listing all the dependencies. The second command installs Flask directly.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 8: Run the Flask Application
&lt;/h5&gt;

&lt;p&gt;To ensure everything is working correctly, run the Flask application using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command starts the Flask development server, allowing you to test your application locally.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 9: Install Gunicorn
&lt;/h5&gt;

&lt;p&gt;Gunicorn is a production-ready web server for running Flask applications. Install it using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install gunicorn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 10: Run Gunicorn
&lt;/h5&gt;

&lt;p&gt;To run your Flask application with Gunicorn, execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gunicorn -b 0.0.0.0:8000 app:app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command starts Gunicorn, binding it to all available network interfaces on port 8000.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 11: Create a Systemd Service File
&lt;/h5&gt;

&lt;p&gt;To run the Flask application as a service, create a systemd service file using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/systemd/system/project_name.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 12: Add Code to the Service File
&lt;/h5&gt;

&lt;p&gt;Inside the service file, add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Gunicorn instance for a simple app
After=network.target

[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/project_name
ExecStart=/home/ubuntu/project_name/venv/bin/gunicorn -b localhost:8000 app:app
Restart=always

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code specifies the service description, user, group, working directory, and the Gunicorn command to start the Flask application.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 13: Reload Systemd Daemon
&lt;/h5&gt;

&lt;p&gt;After creating the service file, reload the systemd daemon to make it aware of the new service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl daemon-reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 14: Start the Service
&lt;/h5&gt;

&lt;p&gt;To start the Flask application service, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl start project_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 15: Enable the Service on System Startup
&lt;/h5&gt;

&lt;p&gt;To ensure that the Flask application service starts automatically on system boot, execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable project_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 16: Test the Application
&lt;/h5&gt;

&lt;p&gt;To verify if the Flask application is running correctly, use the curl command to send a request to the local server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is set up properly, you should see the response from your Flask application.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 17: Install Nginx
&lt;/h5&gt;

&lt;p&gt;To set up Nginx as a reverse proxy, install it using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 18: Start Nginx
&lt;/h5&gt;

&lt;p&gt;To start the Nginx service, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl start nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 19: Enable Nginx on System Startup
&lt;/h5&gt;

&lt;p&gt;To ensure that Nginx starts automatically on system boot, execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 20: Configure Nginx
&lt;/h5&gt;

&lt;p&gt;Open the Nginx configuration file using the nano editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/nginx/sites-available/default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 21: Add Upstream and Proxy Pass
&lt;/h5&gt;

&lt;p&gt;Add the following code at the top of the file, below the default comments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upstream flaskhelloworld {
    server 127.0.0.1:8000;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 22: Configure Proxy Pass
&lt;/h5&gt;

&lt;p&gt;Inside the location / block, add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;location / {
    proxy_pass http://project_name;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code sets up the reverse proxy to forward requests to the Gunicorn server running on port 8000.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 23: Restart Nginx
&lt;/h5&gt;

&lt;p&gt;To apply the Nginx configuration changes, restart the Nginx service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations! You have successfully deployed a Flask application on an AWS EC2 instance using Gunicorn and Nginx as a reverse proxy. Your Flask application is now accessible through the Nginx server, providing a robust and scalable setup for your application.&lt;/p&gt;

</description>
      <category>flask</category>
      <category>aws</category>
      <category>nginx</category>
      <category>python</category>
    </item>
    <item>
      <title>How to Reset MySQL or MariaDB Root Password on Ubuntu 20.04</title>
      <dc:creator>Achmad Dinofaldi Firmansyah</dc:creator>
      <pubDate>Fri, 30 Jun 2023 02:39:25 +0000</pubDate>
      <link>https://dev.to/bangik/how-to-reset-mysql-or-mariadb-root-password-on-ubuntu-2004-48gk</link>
      <guid>https://dev.to/bangik/how-to-reset-mysql-or-mariadb-root-password-on-ubuntu-2004-48gk</guid>
      <description>&lt;p&gt;Losing or forgetting the root password for your MySQL or MariaDB database server can be a frustrating experience. However, in Ubuntu 20.04, there are specific steps you can follow to reset the root password and regain access to your database. In this article, we will explore the step-by-step process for resetting the root password for both MySQL and MariaDB on Ubuntu 20.04.&lt;/p&gt;

&lt;h2&gt;
  
  
  MYSQL STEP
&lt;/h2&gt;

&lt;p&gt;Stop the MySQL service by running the following command:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl stop mysql&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Open the MySQL service unit file for editing:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl edit mysql&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Add the following lines to the editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Service]
ExecStart=
ExecStart=/usr/sbin/mysqld --skip-grant-tables --skip-networking
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save and close the editor. This will create an override for the MySQL service and reload the systemd daemon to apply the changes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl daemon-reload&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start the MySQL service with the new configuration:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl start mysql&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Log in to the MySQL server as the root user without a password:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo mysql -u root&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Inside the MySQL prompt, flush the privileges to ensure the changes take effect:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;FLUSH PRIVILEGES;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Set a new password for the root user. Replace 'new_password' with your desired password:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'new_password';&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Revert the changes made to the MySQL service by running:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl revert mysql&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Reload the systemd daemon again:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl daemon-reload&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Restart the MySQL service to apply the new password:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl restart mysql&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can now log in to MySQL as the root user using the new password:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mysql -u root -p&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  MariaDB Step
&lt;/h2&gt;

&lt;p&gt;Stop the MariaDB service:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl stop mariadb&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Set an environment variable to start MariaDB with skip-grant-tables and skip-networking options:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start the MariaDB service with the new configuration:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl start mariadb&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Log in to the MariaDB server as the root user without a password:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo mysql -u root&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Inside the MariaDB prompt, flush the privileges:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;FLUSH PRIVILEGES;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Set a new password for the root user:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Update the authentication_string column to ensure it's empty:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;UPDATE mysql.user SET authentication_string = '' WHERE user = 'root';&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Update the plugin column to ensure it's empty:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;UPDATE mysql.user SET plugin = '' WHERE user = 'root';&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Set the new password using caching_sha2_password authentication plugin:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'new_password';&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Unset the environment variable to revert the changes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl unset-environment MYSQLD_OPTS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Restart the MariaDB service:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo systemctl restart mariadb&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can now log in to MariaDB as the root user using the new password:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mysql -u root -p&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Remember to replace 'new_password' with your desired password in both the MySQL and MariaDB steps.&lt;/p&gt;

&lt;p&gt;By following the step-by-step instructions provided in this article, you should be able to successfully reset the root password for both MySQL and MariaDB on Ubuntu 20.04. Remember to choose a strong and secure password to ensure the safety of your database.&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>ubuntu</category>
      <category>mariadb</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Deploy Laravel to EC2 AWS</title>
      <dc:creator>Achmad Dinofaldi Firmansyah</dc:creator>
      <pubDate>Thu, 29 Jun 2023 01:01:18 +0000</pubDate>
      <link>https://dev.to/bangik/how-to-deploy-laravel-to-ec2-aws-203i</link>
      <guid>https://dev.to/bangik/how-to-deploy-laravel-to-ec2-aws-203i</guid>
      <description>&lt;p&gt;Are you looking to deploy your Laravel application on an EC2 instance in AWS? In this tutorial, we will walk you through the step-by-step process of deploying Laravel to EC2 using Apache as the web server. Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Install PHP with Apache2
&lt;/h2&gt;

&lt;p&gt;First, we need to install PHP and Apache on our EC2 instance. Connect to your EC2 instance using SSH and run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4
php -v
sudo apt-get install -y php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath
php -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This step installs PHP and Apache web server on your EC2 instance. It ensures that you have PHP installed with the necessary extensions required by Laravel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Install Composer
&lt;/h2&gt;

&lt;p&gt;Composer is a dependency management tool for PHP. We need to install Composer to manage the dependencies of our Laravel application. Run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Composer is a dependency management tool for PHP. This step installs Composer on your EC2 instance. Composer will be used to manage the dependencies of your Laravel application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Install Laravel or Clone Laravel from Git
&lt;/h2&gt;

&lt;p&gt;Next, navigate to the /var/www directory and either install Laravel using Composer or clone an existing Laravel project from Git. Here are the commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /var/www
# Install Laravel using Composer
composer create-project --prefer-dist laravel/laravel your-project-name

# OR

# Clone Laravel project from Git
git clone git@github.com:yourusername/your-repo.git your-project-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this step, you navigate to the /var/www directory, which is the default web directory for Apache on Ubuntu. You have two options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Laravel using Composer: This command creates a new Laravel project in the your-project-name directory using the laravel/laravel package.&lt;/li&gt;
&lt;li&gt;Clone Laravel project from Git: This command clones an existing Laravel project from a Git repository into the your-project-name directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Replace your-project-name with the desired name for your Laravel project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Configure the Environment
&lt;/h2&gt;

&lt;p&gt;After installing Laravel or cloning the project, you need to configure the environment. The .env.example file is copied to .env. You should edit the .env file and set up the appropriate database configuration for your environment.&lt;/p&gt;

&lt;p&gt;Copy the .env.example file to .env using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /var/www/your-project-name/.env.example /var/www/your-project-name/.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the .env file and set up your database configuration according to your environment.&lt;br&gt;
Generate a unique application key by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /var/www/your-project-name
php artisan key:generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The php artisan key:generate command generates a unique application key, which is used for encryption and other security-related purposes in Laravel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Database Migration
&lt;/h2&gt;

&lt;p&gt;Laravel provides a migration system to manage database schema changes. The php artisan migrate command runs the database migrations and creates the necessary tables in your database based on the migration files defined in your Laravel project.&lt;br&gt;
Run the database migrations to create the necessary tables in your database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Set File and Folder Permissions
&lt;/h2&gt;

&lt;p&gt;To ensure that your Laravel application has the correct file and folder permissions, run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R www-data:www-data /var/www/your-project-name
sudo find /var/www/your-project-name -type f -exec chmod 644 {} \;
sudo find /var/www/your-project-name -type d -exec chmod 755 {} \;
cd /var/www/your-project-name
sudo chown -R $USER:www-data .
sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This step ensures that the appropriate file and folder permissions are set for your Laravel project. It ensures that the web server (usually www-data user) has the necessary permissions to access and modify files.&lt;br&gt;
The commands in this step set the ownership and permissions recursively for the Laravel project directory.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 7: Configure Apache2
&lt;/h2&gt;

&lt;p&gt;Apache needs to be configured to serve your Laravel application. This step involves creating a new Apache configuration file specific to your project.&lt;/p&gt;

&lt;p&gt;Create a new Apache configuration file for your Laravel project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/apache2/sites-available/your-project-name.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste the following configuration into the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;
    ServerAdmin admin@hwdomain.io
    ServerName laravelapp.hwdomain.io
    DocumentRoot /var/www/your-project-name/public

    &amp;lt;Directory /&amp;gt;
        Options FollowSymLinks
        AllowOverride None
    &amp;lt;/Directory&amp;gt;
    &amp;lt;Directory /var/www/your-project-name&amp;gt;
        AllowOverride All
    &amp;lt;/Directory&amp;gt;

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace your-project-name with the actual name of your Laravel project. The ServerName directive should match your desired domain or subdomain.&lt;/p&gt;

&lt;p&gt;The configuration file sets the ServerName directive to the desired domain or subdomain for your application. The DocumentRoot points to the public directory of your Laravel project.&lt;/p&gt;

&lt;p&gt;Create a symbolic link for the configuration file in the Apache sites-enabled directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ln -s /etc/apache2/sites-available/your-project-name.conf /etc/apache2/sites-enabled/your-project-name.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, the configuration enables the necessary overrides and logging for your Laravel application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8: Restart Apache
&lt;/h2&gt;

&lt;p&gt;Finally, you need to restart the Apache web server for the configuration changes to take effect. This ensures that your Laravel application is now being served by Apache and can be accessed using the specified domain or subdomain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo service apache2 restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! Your Laravel application is now deployed on an EC2 instance in AWS. You should be able to access it using the specified domain or subdomain.&lt;/p&gt;

&lt;p&gt;Remember to configure any additional settings such as DNS records or SSL certificates to make your application accessible over the internet securely.&lt;/p&gt;

&lt;p&gt;Congratulations on successfully deploying your Laravel application on EC2 AWS! Happy coding!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>aws</category>
      <category>webdev</category>
      <category>php</category>
    </item>
  </channel>
</rss>
