ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

How to Install XAMPP on Ubuntu Linux - Setting Permissions to Create folder in htdocs

Updated on April 30, 2012

Installing Xampp on ubuntu linux is very easy and it takes few minutes to get server running. What is Xampp ? Xampp is a development web server that has Apache, MySQL, Perl and PHP which makes a perfect package for web development. If you're interested in creating php or perl web apps then all you need to do is install xampp on your system and run the server.

Information on this page will work with most of the modern and older versions of ubuntu installation. As the instructions are the same for almost every linux distribution (except package name and installation part). If you're using windows operating system then you should consider reading xampp windows installation.

Download XAMPP

You need to download the xampp package of your choice. You can choose full package (77mb) or development package (34mb) depending on your needs. I found that development package is enough for my needs. You get almost everything that you need to test the web apps.

Download Xampp from apache friends website.

XAMPP Installation on Ubuntu

We're going to navigate to the downloads directory and going to install xampp from there.

cd Downloads

You'll get prompt set on /Downloads directory in terminal.

Ubuntu requires root privileges for any type of software installation or configuration. So you have to enter su or sudo command in terminal.

sudo tar xvfz xampp-linux-1.7.7.tar.gz -C /opt

That's all. You've xampp installed in your /opt directory. You can browse to this directory and check if the files are extracted properly.

XAMPP on Linux
XAMPP on Linux

Testing XAMPP Server

Now that we have all the files and stuff set, let's test the xampp server. Type the following command in terminal.

sudo /opt/lampp/lampp start

Make sure that you use the above command every time when you want to run xampp server. You need to type sudo before executing the start script. You don't need sudo for shutting down web server though. You can also use batch scripts at startup to start xampp if you're using the machine exclusively for web development purpose.

Open firefox or chrome in ubuntu and check the following web address.

http://localhost

You'll notice the xampp welcome page on this address. Let's see if we can edit any files or folders in htdocs directory.

How to Create folder in htdocs directory of Xampp in Ubuntu

As you noticed earlier that you can't create any file or directory in this folder. You check the permissions on htdocs directory or any other directory in lampp folder.

ls -ld /opt/lampp/htdocs

As you can see it shows the owner and the groupname of the htdocs directory. As you're not part of that group or not even owner that is why you can't edit the files or create new folder in that directory.

drwxr-xr-x 4 user nogroup 4096 2011-10-31 12:43 /opt/lampp/htdocs

Now that there is no group listed as "nogroup'. You have to add the group in order to let your username manipulate the directory or files in it.

sudo groupadd www

We're creating group www here and then we'll add the group permission to the htdocs directory.

sudo chgrp -R www /opt/lampp/htdocs

We need to set the permission for this directory so that our current user can use the directory.

sudo chmod 2775 /opt/lampp/htdocs

Once you do that logout from the system to let the change take effects. Once you log back in, you need to run this command to check the permission and the group for htdocs folder.

ls -ld /opt/lampp/htdocs

Permissions are changed and now we need to add our user to this user group.

sudo usermod -aG www username
or

sudo chown -R username path/to/htdocs

Inset your username in the field and run the command. You now have the user in the group. Log out again and check the permission and user in this group.

Now that you can create, move and delete stuff from this document, xampp will be more easy to use for your own web-apps. Let me know if this guide helps you in anyway.

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      Naoman 

      4 years ago

      Thank you so much. It was very helpful/

    • profile image

      nepo 

      5 years ago

      thanks alot my friend...tryed so many tutorials this night to get this to work..but it made it more and more worse..almost wanted to uninstall ubuntu but then i found your article and now everything works! thanks alot so good!!

    • profile image

      Hadi 

      6 years ago

      You just make it easy step-by-step tutorial .

      Thanks.

    • profile image

      steven 

      6 years ago

      nice guide!

    • profile image

      Raffaele 

      6 years ago

      You solved my problem.

      Thanks

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)