{"id":563,"date":"2025-03-02T23:18:40","date_gmt":"2025-03-02T23:18:40","guid":{"rendered":"https:\/\/www.flexpaul.com\/?p=563"},"modified":"2025-03-16T18:06:21","modified_gmt":"2025-03-16T18:06:21","slug":"setting-up-my-developer-environment","status":"publish","type":"post","link":"https:\/\/www.flexpaul.com\/index.php\/2025\/03\/02\/setting-up-my-developer-environment\/","title":{"rendered":"Setting up My Developer Environment."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">My Hardware &amp; Software<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>HP Pavilion Gaming Laptop 15-dk0xxx<\/li>\n\n\n\n<li>Processor: 8 \u00d7 Intel\u00ae Core\u2122 i5-9300H CPU @ 2.40GHz<\/li>\n\n\n\n<li>RAM: 7.6 GiB of RAM<\/li>\n\n\n\n<li>GPU: Mesa Intel\u00ae UHD Graphics 630<\/li>\n\n\n\n<li>Ubuntu Studio 24.04<\/li>\n\n\n\n<li>VSCode<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Going to Add:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Apache<\/li>\n\n\n\n<li>MariaDB<\/li>\n\n\n\n<li>php8<\/li>\n\n\n\n<li>phpMyAdmin<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s get started and Install apache2, run the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt install apache2<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo ufw app list<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see Apache, Apache Full, and Apache Secure and depending on your particular setup, you may see more.  I ran sudo ufw status right away and it is inactive, however, we will still run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo ufw allow in \"Apache Full\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo ufw status<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Onto installing MariaDB.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt install mariadb-server<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mysql_secure_installation<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">THIS TIME:<br>First Question: Set a Password, I have been having issues (could just be the fact of too many passwords too many servers), for dev, simple but strong. (Set Password)<br>Second Question: NO (Switch authentication)<br>Third Question: NO (Change Password)<br>Fourth Question: YES (Remove Anonymous User)<br>Fifth Question: YES (Disallow root login remotely?)<br>Sixth Question: YES (Remove Test DB)<br>Seventh Question: YES (Reload Privilege)<br>That should complete it.<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl status mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u25cf<\/strong> mariadb.service - MariaDB 10.11.8 database server\n&nbsp;&nbsp;&nbsp;&nbsp;Loaded: loaded (\/usr\/lib\/systemd\/system\/mariadb.service; <strong>enabled<\/strong>; preset: <strong>enabled<\/strong>)\n&nbsp;&nbsp;&nbsp;&nbsp;Active: <strong>active (running)<\/strong> since Sun 2025-03-02 13:55:25 PST; 22min ago\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Docs: man:mariadbd(8)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n&nbsp;&nbsp;Main PID: 34436 (mariadbd)\n&nbsp;&nbsp;&nbsp;&nbsp;Status: \"<strong>Taking your SQL requests now...<\/strong>\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tasks: 9 (limit: 61037)\n&nbsp;&nbsp;&nbsp;&nbsp;Memory: 78.8M (peak: 82.4M)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CPU: 1.055s\n&nbsp;&nbsp;&nbsp;&nbsp;CGroup: \/system.slice\/mariadb.service\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u2514\u250034436 \/usr\/sbin\/mariadbd\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Not sure if that even worked correctly, it you get stuck, Ctrl + C to get back to the command prompt.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mysqladmin version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqladmin &nbsp;Ver 10.0 Distrib 10.11.8-MariaDB, for debian-linux-gnu on x86_64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now lets get php8 installed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt install php libapache2-mod-php php-mysql phpmyadmin<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When prompted &#8220;Configuring phpmyadmin&#8221; make sure you select the Web server to reconfigure automatically as the one we installed, which is apache2.  Press space to add a * and &lt;tab&gt; to &lt;Ok&gt;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Select &lt;Yes&gt; to Configure database for phpmyadmin.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I (once again) left application password for phpmyadmin blank.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open your Favorite web browser and navigate to localhost and you should see a page that says&#8212;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It works! (usually wrapped in an orange banner)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now to cleanly setup phpMyAdmin.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter your sudo password.  You should be at the following prompt.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MariaDB &#91;(none)]&gt; <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now we create a user for phpmyadmin!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure you use your username and your password.  I know its funny seeing your password on the screen, but once this is done, it&#8217;s set, remember, it is independent of your system password, so if you change your system password, your MariaDB password is not affected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Output<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>Query OK, 0 rows affected (0.013 sec)<\/strong>\n\nMariaDB &#91;(none)]&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Grant privilege:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL PRIVILEGES ON *<em>.<\/em>* TO 'your_username'@'localhost' WITH GRANT OPTION;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Again, change your_username to your actual user name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FLUSH PRIVILEGES;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>EXIT;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can test by navigating to localhost\/phpmyadmin in your web browser and using your credentials to login.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">The Following you can skip if you don&#8217;t want to store your password in a config file and is very insecure, but in a development environment it is useful.<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s edit the phpMyAdmin configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Following In summary:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re comfortable with being prompted for your username and password each time, the current setup is fine and more secure.<br>If you want automatic login, you can switch to config authentication, but be aware of the security risks.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/phpmyadmin\/config.inc.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Find the $cfg[&#8216;Servers&#8217;][$i][&#8216;auth_type&#8217;] line and ensure it&#8217;s set to config:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'auth_type'] = 'config';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the username and password you created:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'user'] = 'your_username';<br>$cfg&#91;'Servers']&#91;$i]&#91;'password'] = 'your_password';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace your_username and your_password with the credentials you set in MariaDB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Restart Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can now navigate to localhost\/phpmyadmin and be automatically logged in. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This method is great if your in a development environment and don&#8217;t want to logon to phpmyadmin every time you open it.  However, from what I understand, if you do this in a production environment (I am not sure if phpmyadmin would even be running in this type of situation) this will allow anyone to open phpmyadmin with your credentials.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Final Things I did to work with my environment.<br>First thing, make a symlink to my project folder in my home directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/home\/$USER\/my-web-project \/var\/www\/html\/my-web-project<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure Apache can read and write to my local directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><s>sudo chmod -R 755 \/home\/$USER\/my-web-project<\/s>\nsudo chmod -R 775 \/home\/$USER\/my-web-project\n\nsudo usermod -aG www-data yourusername\nsudo chgrp -R www-data \/var\/www\nsudo chmod -R g+w \/var\/www\n\nnewgrp www-data\n\nLogout and back in<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Use Access Control Lists (ACLs):<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ACLs provide more granular control over file permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Set ACL:<\/strong> Bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo setfacl -R -m u:your_username:rwx \/var\/www\/html\nsudo setfacl -d -m u:your_username:rwx \/var\/www\/html<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>setfacl<\/code> modifies ACLs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-R<\/code> applies the changes recursively.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-m u:your_username:rwx<\/code> grants read, write, and execute permissions to your user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-d<\/code> sets the default ACL, so new files and directories will inherit the permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>View ACLs:<\/strong> Bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>getfacl \/var\/www\/html<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">ACLs are generally preferred over fully changing the group permissions.<\/p>\n\n\n<div class=\"wp-block-post-author\"><div class=\"wp-block-post-author__avatar\"><img alt='Avatar photo' src='https:\/\/www.flexpaul.com\/wp-content\/uploads\/2023\/12\/cropped-cropped-image145-96x96.png' srcset='https:\/\/www.flexpaul.com\/wp-content\/uploads\/2023\/12\/cropped-cropped-image145-192x192.png 2x' class='avatar avatar-96 photo' height='96' width='96' \/><\/div><div class=\"wp-block-post-author__content\"><p class=\"wp-block-post-author__name\"><a href=\"https:\/\/www.flexpaul.com\/index.php\/author\/ppmuetze\/\" target=\"_self\">Paul<\/a><\/p><p class=\"wp-block-post-author__bio\">Coffee-fueled and code-driven, I&#8217;m Paul, a digital nomad tech consultant with a knack for navigating the ever-evolving landscapes of open-source software, solar power, and the occasional political pit stop. With 20+ years of experience under my belt, I&#8217;m excited to share my insights, weave captivating narratives about technology&#8217;s impact, and offer valuable perspectives on leadership and positivity. So, grab your digital passport and join me on this virtual voyage of the internet&#8217;s quirky corners, one thought-provoking discussion at a time. Buckle up, it&#8217;s gonna be an informative and wildly exciting ride!<\/p><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>My Hardware &amp; Software Going to Add: Let&#8217;s get started and Install apache2, run the following commands: You should see Apache, Apache Full, and Apache Secure and depending on your particular setup, you may see more. I ran sudo ufw status right away and it is inactive, however, we will still run the following command: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":570,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[366,402,4,1,383],"tags":[406,403,407,411,18,405,408,404,410,409],"class_list":["post-563","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-phpmyadmin","category-tutorial","category-uncategorized","category-web-server","tag-apache2","tag-developer-environment","tag-linux-tutorials","tag-local-development","tag-mariadb","tag-php8","tag-phpmyadmin","tag-ubuntu-studio","tag-vscode","tag-web-server-setup"],"jetpack_featured_media_url":"https:\/\/www.flexpaul.com\/wp-content\/uploads\/2025\/03\/server-7239721_1280.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/posts\/563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/comments?post=563"}],"version-history":[{"count":10,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/posts\/563\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/posts\/563\/revisions\/600"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/media\/570"}],"wp:attachment":[{"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/media?parent=563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/categories?post=563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flexpaul.com\/index.php\/wp-json\/wp\/v2\/tags?post=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}