• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

help with LAMP setup (linux and web stuff)

rh71

No Lifer
pretty much a newbie to linux and don't fully understand sudo (why don't I have admin privileges if I am the only user and installed under this user?). My goal was to do a LAMP server (through VMWare Player) so I can start doing PHP as well so I am following this guide which seems straightforward: http://www.wikihow.com/Build-a-LAMP-Server I am running the latest Ubuntu.

I am stuck where I'm supposed to save the test.php file. It's saying that I don't have the permission, even though I'm the root (and the only) user.

Is there a way to do this so I don't ever have any user permission problems anymore since I am the root user? Or do I need to do some sudo command everytime, even with something simple like gedit and saving a file into a directory (/var/www in this case). After it didn't work, I even tried adding my root username to a line in etc/sudoers but I have a feeling it's not necessary.

cantsave.JPG
 
Last edited:
gksudo gedit

enter your password when requested, and it should save without problem.

had to install gk and then I did that to open gedit, but untitled document is spinning endlessly and not letting me type into it at all. Hasn't prompted me for password anywhere either.

EDIT>> looks like I can open a new doc instead. Working, thx.
 
Last edited:
(why don't I have admin privileges if I am the only user and installed under this user?).

There are a number of reasons, some of which are that if you were logged on as root all the time, you could accidentally make a mistake which could wreak havoc on your computer programs/data.
Also if you were in a workplace environment, every time you left your computer for 5 minutes, an unauthorised user could jump in and do whatever they liked as root user. (Unless you remember to logout or locked screensaver, every time).

If you are connected to the internet, NOT being logged on as root limits the ability of rogue software/virus's/hacker(s) etc that you may encounter to harm your system.
 
Last edited:
As SOFTengCOMPelec said, to protect your OS from mistakes/harm.

This isn't just a Linux thing, you should minimize using an admin account on Windows and Mac OS X, etc. as well.

Probably the easiest thing to do in this case is to change the permissions of /var/www to be owned by your user. While you wouldn't do that on a production server, it's sensible on a development machine.

We'd all recommend learning some command-line chops, as it can be extremely useful.

If you've never used Unix, here's a nice beginner's book:
http://www.amazon.com/Linux-Command-...dp/1593273894/

I'm sure there's tons of gratis material out there also.
 
There are a number of reasons, some of which are that if you were logged on as root all the time, you could accidentally make a mistake which could wreak havoc on your computer programs/data.
Also if you were in a workplace environment, every time you left your computer for 5 minutes, an unauthorised user could jump in and do whatever they liked as root user. (Unless you remember to logout or locked screensaver, every time).

If you are connected to the internet, NOT being logged on as root limits the ability of rogue software/virus's/hacker(s) etc that you may encounter to harm your system.

my terminal session shows me 'rh71' at each prompt. Judging from your responses, there's an actual "root" user? If there is "root", then could I just add rh71 as admin(all) - or whatever that is in etc/sudoers?
 
Last edited:
my terminal session shows me 'rh71' at each prompt. Judging from your responses, there's an actual "root" user? If there is "root", then could I just add rh71 as admin(all) - or whatever that is in etc/sudoers?

Ubuntu doesn't use the root account. You should get root privileges using your standard account, and sudo.
 
pretty much a newbie to linux and don't fully understand sudo (why don't I have admin privileges if I am the only user and installed under this user?). My goal was to do a LAMP server (through VMWare Player) so I can start doing PHP as well so I am following this guide which seems straightforward: http://www.wikihow.com/Build-a-LAMP-Server I am running the latest Ubuntu.

LInux is a lot of fun. I am a Windows user myself but use LInux a lot for fun and home use.

The frist thing I do after launching a terminal is to give the following command to get root previlege for the session.

sudo -s
enter your password at the prompt

You can launch other gui programs such as gedit (or pluma), nautilus (file browser), nemo etc from there to have root privilege. Sometimes I use mc (midnight commander) for easy navigation within the shell.

exit
to go back to your session

Edit: for php web development, the best option is netbeans. I switched to netbeans/xdebug in the last couple of days from eclipse/PDT. Of course you have to install apache2, php, mysql and xdebug. I had to make minimal configuration changes to php.ini (two lines to add xdebug and enable remote debugging). I always use virtualhost file so that the webserver root will be a folder within my project folder (in my home directory) and edit /etc/hosts to add 127.0.0.1 for that virtual host name.
 
Last edited:
LInux is a lot of fun. I am a Windows user myself but use LInux a lot for fun and home use.

The frist thing I do after launching a terminal is to give the following command to get root previlege for the session.

sudo -s
enter your password at the prompt

You can launch other gui programs such as gedit (or pluma), nautilus (file browser), nemo etc from there to have root privilege. Sometimes I use mc (midnight commander) for easy navigation within the shell.

exit
to go back to your session
Well, that's bad advice. Sure it's a bit of an inconvenience, but elevate privileges (only) when you need it. It'll maybe SYA from a mistake or malware.

To be clear, there's nothing inherently wrong about su or "sudo -s" when you need superuser privileges for a sequence of admin tasks. But normally, that's not 100% of the time.
 
Well, that's bad advice. Sure it's a bit of an inconvenience, but elevate privileges (only) when you need it. It'll maybe SYA from a mistake or malware.

To be clear, there's nothing inherently wrong about su or "sudo -s" when you need superuser privileges for a sequence of admin tasks. But normally, that's not 100% of the time.

I am talking about a user logged in into a Desktop OS like Mint or Ubuntu.

sudo lets you decide when you want to launch a program with root privilege inside a shell. So if you elevate a shell by using sudo -s you should use that shell only to run those commands and programs which you would have otherwise run with sudo.

If a malware can execute by itself inside an elevated shell while rest of your system is running a GUI desktop as a regular user then even sudo may not be of much help.
_
 
Last edited:
pretty much a newbie to linux and don't fully understand sudo (why don't I have admin privileges if I am the only user and installed under this user?). My goal was to do a LAMP server (through VMWare Player) so I can start doing PHP as well so I am following this guide which seems straightforward: http://www.wikihow.com/Build-a-LAMP-Server I am running the latest Ubuntu.

I am stuck where I'm supposed to save the test.php file. It's saying that I don't have the permission, even though I'm the root (and the only) user.

Is there a way to do this so I don't ever have any user permission problems anymore since I am the root user? Or do I need to do some sudo command everytime, even with something simple like gedit and saving a file into a directory (/var/www in this case). After it didn't work, I even tried adding my root username to a line in etc/sudoers but I have a feeling it's not necessary.

cantsave.JPG
I know of 3 basic approaches to this.
1. edit stuff as root using sudo or gksu.
this is the simplest, especially if you are just quickly putting up a bunch of static code to an existing server.

2. Move the document root of the virtual host to a subdirectory in your home by editing the webserver config file.
this is the most elegant IMHO, and easiest if you are planning to be learning/expirimenting, its the default scheme in some distros.

3. take ownership of the default document root with something like:
Code:
sudo chown -R <username>:www-data /var/www
this is the easiest as you will own the code and apache will have group ownership. There may be security implications to consider.
 
Last edited:
Back
Top