How to setup Apache, MySql, and PHP on Ubuntu Linux
HTML-код
- Опубликовано: 11 сен 2024
- How to setup Apache, MySql, and PHP on Ubuntu Linux
0:20 Lamp Stack Intro
3:00 Apache Setup
5:23 Hosts File
9:35 Server Folder
14:40 Create a Vhost
22:33 Install PHP
25:40 Vhost Automation
31:51 Install MySql
:: Support Me ::
www.alecaddd.co...
:: Tutorial Series ::
WordPress 101 - Create a theme from scratch: bit.ly/1RVHRLj
WordPress Premium Theme Development: bit.ly/1UM80mR
Learn SASS from Scratch: bit.ly/220yzmZ
Design Factory: bit.ly/1X7Csaz
Affinity Designer: bit.ly/1X7CrDA
:: My Website ::
www.alecaddd.com/
:: Follow me on ::
Twitter: / alecaddd
Google+: bit.ly/1Y7sunz
Facebook: / alecadddpage
I'm only 13 minutes in to the video, and already I think it deserves to be a paid course. Awesome work.
Was perfect ! Thanks for all helps and the "virtualhost" package!
Same here 👊
Thanks to you I was able to clearly understand how to setup a local PhP project, even though I always struggled with the whole process which graduated to very messy configurations. Thank you Master
Thank you very much for this explaination. Automation work very well and easely! Emmanuel
Man this is one of the best tech vids/channels on the web, thank you man! Can't wait to learn how to make wordpress plugins with ya :) subbed
Thank you so much :) I'm new to the LAMP Stack and you made it super simple to understand
+geeky_will awesome! Check my new series Working with Linux for an updated version and easier approach to local development
Thank you! I had Apache up and running over a decade ago, and have not touched it since I remember the highlights but the details have all left me. i love this presentation style, show the exact command, explain the command and then show the results in the GUI I loose a lot of time getting the command line syntax/grammar correct, a lot of places will tell you this command does this, but seeing it typed out with directories and folders and arguments is very helpful for learning. (re-learning)
You are the one tutorial who unlock the basic understanding of all this PHP stuf thank you.
You're very welcome :D
THANK YOU!!! I had been trying to set it up for 2 weeks, and this video answered everything!
This was so damn helpful. Really really amazing and well explained video. Thank you so much for all the help !
Thank you so much for this. learned a lot. I just purged and reinstalled apache2 because I messed up too much with my previous installation. Now, I am leaving the defaults untouched and creating new files that match my website. Much Thanks again.
Cheers
thanks for the video, this tutorial works after 4 years, so much value information
You got no idea how much you have helped me! Thank you so much!
Well, now I know :D
Thank you so much for watching
@@alecaddd You are most welcome. Thank you so much for taking the time to reply.
I'm trying to learn different projects to complete on linux, this tutorial really helps, thanks, got a new sub!
Hi!
I am really thankful for this comprehensive step-by-step guide, it was really helpful for me even though I have very little experience with apache servers and bash commands.
Great job!
Awesome, I'm glad I was helpful.
Cheers
Hi Alex, Nice tutorial again! Thumb up!
You guys should also add ServerAlias in the vhost config file. For example you have the ServerName: test.dev and the ServerAlias will be www.test.dev
This setup it offers more flexibility. Enjoy it.
Hi George, thank you so much for watching.
Yes, I'm aware of the ServerAlias, in fact, you can find it in the script I use for automating the process.
I decided to keep the Vhost file really simple for the tutorial, just to avoid confusion and too much information for an already long video.
Thanks for flagging that out!
I supposed you already know about it, and when I've wrote the comment was before seeing the script part oft the video :) But that should change in www. because if you use wordpress and you set it up on domain.com and then you will need to put it on www.domain.com... then you will discover that you will have more changes to do than to modify only the .htaccess file. (from my experience...)
I will recommend using the www. as Alias. It is also a good practice.
I am speaking as a guy which is more into servers than programming :)
Keep up with the tutorials because I like them and I enjoy them. You are speaking clear about the thing to do and everything is so clear to understand, so in the name of me and others I say thank You!
If I will reach America sometime... We will have a beer! :) Thumb up!
I really appreciate you're video dude, I was struggling with this shit of lampp where we can put no extension (and do not use correctly such as great things as symfony or cake console), so I'm really happy to learn how to set a real server.
Awesome, I'm glad I was helpful.
I just started a mini-series about Linux where I'm showing my full setup, from the terminal to the local environment, code editor, extensions, etc.
I hope it'll be useful for you.
Cheers
Best explanation i have ever seen
This video is very helpful and well-explained, it helps me to get to know how a server work. Thank you so much
Thank you very much, i was thinking to switch from windows to linux after my graduation next month so i should look for this instruction and here you are doing the job this was very helpful
Wow, I'm glad I got you at the right time :D
I will do more and more videos about Linux to help users like you (and me) to get a professional workflow for both development and design.
Cheers
this will be very appreciated. thank you
Sir you are the best 🙏
This is so well explained i immediately had to like subscribe
Thank you so much
Thank you so much
Thank you dude............... you saved me. Please do more tutorials. Make a tutorial how to link LAMP to wordpress?
Check my playlist Switching to Linux where I showed my entire setup and how to install WordPress locally.
For this video on 32:27, I have a huge problem... IT doesnt allow me to get to package configuration to change new password for the MSQL "root" user.. Please help.
Thanks, this has really helped me alot. Nice videos, keep them coming.
Thank you so much for watching, I'm glad it helped :D
thank you very much. it is very helpul for us
Happy to help
Thank you Sir! Simply and clear tutorial!
I automatically hit the like button !
thanks for guide step-by-step commands
when i add test.dev to /etc/hosts file it doesnt open in the browser, it says unable to connect ..can you help at your convenience, thanks in advance
thats the same happend with me, you find the solution for this problem ?
@@zedolok4508 same with me. Please let me know of the solution
It's because the .dev domain is now automatically redirected in chrome (and now firefox I suppose)
ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/
such a thoughtful and useful tutorial. Good job!
that was magnificent, thanks for the informative explanation
keep-up big fan
Redirecting to https is an issue for making the test.dev work. It doesn't look into the local machine. It searches the internet. Any workaround?
It's a very useful tutorial! Thanks a million!
Thank you so much for watching :D
Thank you so much!! Your explanation is the besttt
I do not usually comment... but this is a VERY good video... VERY WELL DONE!... I highly recommend it to people trying to figure it out for the first time. My only request would be if you had any solution for linking EDIs to the stack... I wanted to try and use eclipse seem to have issues with the host server and Xdebug. But that was before I watched this vid, anyway that would be the only thing I would add.
Thanks for this video because I was lost at first on how get a web server of my on up and running.
You're welcome
this helped me a lot. thank you for the tutorial
the automatic virtual host thing is great. Wish there was a way to automate the ownership of the folder it creates.
Does anybody has a problem when entering test.dev in browser it tries to redirects to a site rather than local host?
Yes but i cannot find a way to fix it so i go back to ubunut server...
Yeah. I think .dev extension is the problem here. Try using something else like test.local or test.test or test.random it's working. Do let me know if you figure out how make .dev work.
@@avatsavirs test.local worked. Thanks
@@avatsavirs Thanks man it's also really worck for me.
without dot . works for me. example: testlocal
Great video, but i have the following problem:
I am running the website on my raspberry pi. How can i access the websites from another computer in my LAN? With the ip-adress from my pi, i can only reach the pre-build website in "/var/www/html"
GREAT VIDEO! as always.
Thank you so much :D
Because I'm using a RaspberryPi without any GUI (connected via ssh) I've installed phpmyadmin to manage the mysql database. Maybe you could look this up as well if someone want to use it too.
But greate video. I love the virtualhost.sh file :D
Greetings BlankWolf
Oh yes, that's a good point.
DBeaver, like SeuquelPro, has the ability to connect to a remote database in SSH, that's why I decided to go that route instead of a web based MySql access.
I've always wanted to play with a RaspberryPi but never got the chance. How is it? How do you use it, and why did you pick it?
Cheers
I bought the RaspberryPi because I'll try to improve my Linux knowledge (primary for my new work) The Pi is simply connected via Cabel with my Router and I connect me via SSH with the pi. I also use samba to create a Windows Networkdrive (only to the /var/www folder). I'm also working with symfony3. :)
Sweet!
I recently started using Symfony to build CLI apps on PHP, pretty handy.
I'm looking forward to see your new PRogramming Series :D
Ciao, sono arrivato fino ad installare dbeaver ma una volta che provo a testare la connessione del server MySQL mi da l'errore "Access denied for user 'root'@'localhost'
". Ho provato anche ad aggiungere un altro user tramite il terminal assegnando a questo il plugin "auth_socket" ed ho provato ad utilizzarlo durante la creazione della connessione al DB su dbeaver, ma niente, continua a non collegarsi. Qualche consiglio? Grazie.
[RISOLTO] Ho cambiato il plugin del user 'root' da "auth_socket" a "mysql_native_password" mettendone una a mia scelta. Per fare ciò ho utilizzato il terminal (scrivo per quelli che si trovano nella mia situazione):
1) sudo mysql -u root -p
2) ho inserito 2 volte la password del account per accedere ad Ubuntu
3) alter user 'root'@'localhost' identified with mysql_native_password by 'password_a_scelta'
Comunque ottimo tutorial !
Thanks, very helpful
Cheers
i dont get it i did as he did but when i write test.dev the browser makes test.dev and says it cant find it
Use your default browser. Do not use other browsers like Opera
Great and very helpful tutorial! Thank you
Congratulations very good video!!
Cheers
Hi .. good video very good explained .. helps a lot thanks ...
Man you are magician! Thanks a lot it's greate tutorial.
Index of / page not display in my case.
Works perfectly fine. Thanks!
`test.dev` does not work anymore, but testdev, localhost_2 do.
I did not understand the use of symlink? Why do we need it? Can you please explain?
yes all the things are ready and running properly .
Thanks a million
You're very very welcome :D
Great video ! Thank you !
Thanks for watching :D
i love this ....you are the best
Thank you so much :D
Thanks. Well presented.
thank you , that was very helpful
You're very welcome :D
Awesome! Thank you!
Cheers
Thx for the video mate!
I myself made a mistake and took me an hour to solve it. 4 ppl in the future:
My mistake:
I couldn't reach test.dev because I enabled test.dev.conf restarted and figured out the first time I enabled test.dev.conf as a result test.dev never worked anymore.
Started over with test.local did sudo a2ensite test.local and this worked. Never got test.dev working again =s even if I did sudo a2ensite test.dev
Command:
sudo a2ensite test.dev
I did:
sudo a2ensite test.dev.conf (WRONG!!! )
Hi Alessandro - excellent - thanks very much. Can you perhaps take this one step further by: showing how another PC on a LAN accesses the website through a browser. I can currently access the webserver (Linux - Mint) through the web browser. But, it defaults to the "Apache - It Works" default website, but not the new virtual website created as per your tutorial. If you could explain this and what additional settings are required in the Apache Server - would be highly appreciated.
Please after running the script, mine displayed "Unable to connect". Please what could be the problem?
Easily explained 😃
Thanks for watching :D
Ho passato tutto il tutorial a chiedermi se eri italiano, poi, solo dopo mezzo'ora, ho letto il nome del canale
Non puoi mai esserne certo al 100% :P
hii! I was using sudo php -S localhost:8080 from any directory to host my php file but now its not working please help
This was perfect, thanks!
Quick question - I ran the script to create the site and the folder, but the folder in my www folder has the lock on it. It is owned by root. Is that okay? Is that the way the script is supposed to work because I don't see that lock when you show the site folders in your www folder.
Hi alex, what screen recording app that you used in this video? Btw, thank you for all your video!
I'm using OpenBroadCaster
Hi, great video, everything gets simpler.
Little question though: I have just set up a new WordPress website using SSH and now I simply would like to access my website file directory but I have no idea how. Any suggestion?
Thanks for your help.
Thank You very much
You're welcome 😁
it's very good tutorial
at 13:06 you change the permissions of the /var/www to make it read-able but not write-able.. In you example, you can then add a directory etc. into the test folder. Why does this allow us to create files etc in that directory and not in the others (www folder)? Is it because we are the owners?
At minute 06:30 I saved the test.dev using sublime text, through terminal, but I got a "This site can't be reached" message! I had installed the MariaDB right before installing Apache2. Could that be the cause?
It's google's fault :P
Google made the .dev domain a TLD, or Top Level Domain, so now, without an SSL certificate (HTTPS connection) you can't access your local environment. You should be able to solve it by changing the extension, using something like .app, or .devel
Cheers
You guessed right that I tried it by using the Chrome web browser. Mille grazie dalla Grecia, mio amico!
I tried to change the extension but nothing happened. I tried with Firefox but it does not work either. Am I right to assume that one would have to alter the "sites-enabled" folder to get around this problem? The website at jmcoimbra.github.io/LAMP-env/ seems to say that!
Same for me ! I've followed every steps of the video and I even changed the extension after having read the comment. But I have the same result :(
Did the jmcoimbra site work for anyone?
I recently moved from windows to linux. The websites i created on windows and used to test using xampp are no longer working on the virtualhost i created. Specifically there is a problem connecting to the database. When i submit the data in the form I get HTTP ERROR 500 (myregistrationform.local is currently unable to handle this request).
In the test folder i put simple html file even that too is not running in localhost please guide, though i first did exactly the same way but php file didnt run despite php is installed.
Since Google, and Mozilla, made such a mess with the new TDL changes, of 2017, could you make a video, using the openssl software, to replace this rather out-of-date, video? Thank you for your time, Alecaddd.
I already did :D
Here's a tutorial using Valet Linux: ruclips.net/video/l1ZX0ZLxRps/видео.html&list=PLriKzYyLb28nRMNbet5iXM_UlE2ddok7k&index=9
Check also the rest of the playlist as I go through the steps of setting up all the most common tools for a developer.
Cheers
the script creates all the necessary files and i cant seem nothing wrong with the structure or syntax of the files but its still not showing up on my browser. using ubuntu 18.04, apache2 2.4 and php 7.2
Wondering what could be the issue here. Cuz when i manually configure the site its working completely fine, so it must have something to do with the script.
Now chrome and other browsers are directing http to https if youre using .dev domains and cause to get "... .dev refused to connect." error. So it s better to use .test domain or add valid ssl certificate.
Thanks man!
Can you help me a question
I installed mysql server and i have a file database(.sql), how i can put it on my sql.
Thank you!
Since I tried LEMP, nginx instead of apache, I have not install LAMP for long time, Apache is easy to be down when the memory is small
I'm actually running Nginx on my production servers, and I agree with you.
I will definitely make a video on how to set it up and the differences with Apache.Thanks for the suggestion!
Great tutorial!
One thing that didn't go so well is the Virtualhost script, on Ubuntu 18.04 I get this "/usr/local/bin/virtualhost: 8: /usr/local/bin/virtualhost: Syntax error: newline unexpected".
You can try using Valet Linux, it's more compact and easier solution.
I have a video in my playlist Working with Linux, check that out :D
Che cosa posso dire?)) It is amazing !)))))
Ahahaha, grazie mille :D
Awesome!!!!!
Thank you :D
Hey i got some problem. I can't see php info
do the services start on bootup or do i have to start them manually?
Yes. If it doesn't, you can also type "sudo systemctl enable apache2" to enable it on start of bootup.
Great video, thank's you !
Could you explain also how to delete/uninstall a website ? (by exemple to remove the test.dev :p )
Thank's you
man i'm not getting that password bar when installing mysql-server
thank u pro :).
Very good video. Except I'm a terrible typist. I have to "pause the video: and when I do the title of the video is covering up what you just typed. So I have to back it up play it several times to see what you typed.
I am a facing a problem that when i open my project in browser the tree structure cant be display as showing in your video.
Is your apache server running properly?
Are there any issues if I use PosgreSQL rather than MySQL?
Postgres is potentially a more robust DB. Go for it.
Perfect.
Did you ever try Gravit Designer on your Linux ? I am using it. I think it's worth trying ...
Yes, I tested it but I didn't like it.
It's a web app wrapped around a container to act like a native app, but it's actually not.
It works fine when dealing with small projects or non-complicated files, but it slows down pretty quickly when the file grows.
Web apps are still not there yet, too "far away" from the CPU and not really responsive.
That's the same reason I use Sublime text instead of Atom.
What are your thoughts about it?
Yes, it slows down. But there is nothing better for Linux :( !
I do use sublime regularly, but recently sometimes I use vs code too.
For design if you find something better for Linux please share with us.
I'm currently developing a native UX Design app for Linux, written in C++ and Qt.
Here's the UI progress: forum.alecaddd.com/d/34-completed-akira-ui
And here's the dev and roadmap overview: forum.alecaddd.com/d/50-akira-development
I just started, and nothing will be remotely usable for at least 2 months, but I want to fill that gap, and make Linux also usable for designers :D
WOW!!! Linux is my primary operating system. I am currently using "debian stretch". Sometimes I need software on which I can design UI for my projects, but none of the available software has even 80% to work with.
I wish "Akira" will be one of the greatest software ever for design in Linux :D
I will try to make that happen!
I'm in your same situation. I'm 75% developer, 25% designer, and when it comes to design, I'm still forced to use my Mac, and I can't stand it anymore.
Building a solid, professional, and native vector App for UX and UI design is absolutely necessary.
You can support Akira by tweeting #AkiraUX and #LinuxLovesDesigners, and spread the news :D
I'll do my best to make it fast and easy to use, and hopefully, it won't suck :P
Hello Alex, Is it safe to use Virtualhost Manage Script on my production server?
Mhhh...I wouldn't recommend it.
I mean, it works and I never had issues with it, but always be careful when using automated scripts on your production server.
If you want to try it, do a backup first, and be sure your folders match where the virtualhost script will try to interact.
And before all of that, test it on a staging server, or local server.
I don't want to be responsible of the destruction of your production server :D
my computer uses ARM cpu architecture. will this github download work?
I'm using vs code for writing the php program and need to the run it in apache2 sever
thanks
You're very welcome
Hi Alex, I am new in php and linux. my test.dev.conf file says read-only, I cant change the modifications
Are you acting as root user? Can you edit it if you open it with sudo?
I think I am root user, I dont have sublime editor I have gedit, and I dont know how to open the file with sudo. I tried only without terminal.
That's a root file that needs to be opened with sudo from the terminal, or you can open a new instance of your file manager as administrator.
Ok, I will do so, what is the command to open the file?
I`ve tried to open the file in terminal
(gedit etc/apache2/sites-available/test.dev.conf) ...same thing.
i don`t know how can I open with sudo command.
does it work on just linux
helpful
How can i disable the standard 000-default.conf? it still shows the apache2 page :(
+Thomas Sieber mhh, I'm not sure about that. Check one my recent Videos about Linux Valet. It's a new and way faster method to setup localhosts
thx for the quick response. you can disable old sites with a2dissite "sitename"
Even after I edited hosts to "test.dev" it didn't show me apache page.....any solutions..?
Check my video about Linux Valet, it's gonna solve all your problems.
@@alecaddd thank you
Did your issue got resolved?
Great tutorial! I'm having a similar problem though. Even after using the script to create the virtual host it still won't connect to anything. Says it succeeded and all the files are in the right place, but won't connect when I type in the address in the browser.
What is the use of valet