1

I have an ubuntu server and an arch linux machine. I've gotten quite used to the apache setup on ubuntu. It's simple and efficient. However, upon installing apache2 on my arch mechine, I noticed everything is different. The daemon doesn't even have the same name. Can someone explain to me:

1: Why everything is so different

2: How i can get the ubuntu apache on arch

4
  • 1
    Your question is way too broad. “Everything is different” is obviously completely untrue. It’s still Apache. it will take the same configuration files on either system. From your comments on the existing answers it appears you’re mainly confused about the shipped configuration files. They aren’t set in stone. You can change them any way you like. You can set up wildcards includes yourself and whatnot.
    – Daniel B
    Aug 12, 2017 at 8:03
  • @GmanSmith I'm currently writing a pretty long answer but the question is why do you want to change?
    – funilrys
    Aug 13, 2017 at 10:53
  • @funilrys i have some tools that dont cooperate with the arch setup of apache Aug 13, 2017 at 18:04
  • 1
    @funilrys a wide variety of tools, i've got a good idea of what i need to do from your answer tho, i've gotten most of it working, thanks!! ^^ Aug 14, 2017 at 2:46

3 Answers 3

3
+100

The other answers are quite good enough about the difference between Ubuntu/Debian and Arch Linux but they are not really "technically oriented" ... I'm not a specialist, I'm just an arch user and an AUR maintainer but I'm gonna try to do my best to answer this more "technically".

Please consider the following as not complete as I'm only talking about the differences (And I'm still not done but the main differences are there). Indeed, as I don't understand why OP need to change I can't answer properly the second part of OP question.

As I'm not a full time Ubuntu/Debian user this answer may have some lack around Debian/Ubuntu explanation.


Differencies

PKGBUILD

As an Arch user and AUR maintainer the first this I do and the first thing that every Arch users should do when such question appears is to read the PKGBUILD of the Apache package which can be found here.

So at the time I write this, it looks like the following

# $Id$
# Maintainer: Jan de Groot <[email protected]>
# Contributor: Andrea Scarpino <[email protected]>
# Contributor: Pierre Schmitz <[email protected]>

pkgname=apache
pkgver=2.4.27
pkgrel=1
pkgdesc='A high performance Unix-based HTTP server'
arch=('i686' 'x86_64')
url='http://www.apache.org/dist/httpd'
license=('APACHE')
backup=(
    etc/httpd/conf/httpd.conf
    etc/httpd/conf/extra/httpd-{autoindex,dav,default,info,languages}.conf
    etc/httpd/conf/extra/httpd-{manual,mpm,multilang-errordoc}.conf
    etc/httpd/conf/extra/httpd-{ssl,userdir,vhosts}.conf
    etc/httpd/conf/extra/proxy-html.conf
    etc/httpd/conf/{mime.types,magic}
    etc/logrotate.d/httpd
)
depends=('zlib' 'apr-util' 'pcre' 'libnghttp2' 'openssl')
makedepends=('libxml2' 'lua')
optdepends=(
    'lua: for mod_lua module'
    'libxml2: for mod_proxy_html, mod_xml2enc modules'
    'lynx: apachectl status'
)
source=(
    https://www.apache.org/dist/httpd/httpd-${pkgver}.tar.bz2{,.asc}
    openssl-malloc-init.patch
    apache.tmpfiles.conf
    httpd.logrotate
    httpd.service
    arch.layout
)
sha256sums=('71fcc128238a690515bd8174d5330a5309161ef314a326ae45c7c15ed139c13a'
            'SKIP'
            'd305f8b52ac2a9bbda7bb0776496471e69e9d30642740f594d00086a8c7e344c'
            '63da1a420f4714a3e7af2672d28384419cc7eedbe7bf35baebd02938fabc15bf'
            '0bbbfae23a917b2fce0bf8f900f60319b50769224a96314e9301a75ccd078e16'
            'f574bac6d5f398e7a649fc0e1ca66ff01ad4ef34dac71258e93d8a9d9a2b3960'
            'dda05c6e76f12624e418ca18a36f2e90ec1c5b1cc52fed7142fce6076ec413f3')
validpgpkeys=('A93D62ECC3C8EA12DB220EC934EA76E6791485A8') # Jim Jagielski

prepare() {
  cd httpd-${pkgver}

  # set default user
  sed -e 's#User daemon#User http#' \
      -e 's#Group daemon#Group http#' \
      -i docs/conf/httpd.conf.in

  cat "${srcdir}/arch.layout" >> config.layout

  # https://github.com/openssl/openssl/issues/2865
  patch -Np1 -i ../openssl-malloc-init.patch
}

build() {
  cd httpd-${pkgver}

  ./configure --sbindir=/usr/bin \
      --enable-layout=Arch \
      --enable-mpms-shared=all \
      --enable-modules=all \
      --enable-mods-shared=all \
      --enable-so \
      --enable-suexec \
      --with-suexec-caller=http \
      --with-suexec-docroot=/srv/http \
      --with-suexec-logfile=/var/log/httpd/suexec.log \
      --with-suexec-bin=/usr/bin/suexec \
      --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
      --enable-ldap --enable-authnz-ldap --enable-authnz-fcgi \
      --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache \
      --enable-ssl --with-ssl \
      --enable-deflate --enable-cgi --enable-cgid \
      --enable-proxy --enable-proxy-connect \
      --enable-proxy-http --enable-proxy-ftp \
      --enable-dbd --enable-imagemap --enable-ident --enable-cern-meta \
      --enable-lua --enable-xml2enc --enable-http2 \
      --with-apr=/usr/bin/apr-1-config \
      --with-apr-util=/usr/bin/apu-1-config \
      --with-pcre=/usr

  make
}

package() {
  cd httpd-${pkgver}

  make DESTDIR="${pkgdir}" install

  install -D -m644 "${srcdir}/httpd.logrotate" "${pkgdir}/etc/logrotate.d/httpd"
  install -D -m644 "${srcdir}/apache.tmpfiles.conf" "${pkgdir}/usr/lib/tmpfiles.d/apache.conf"
  install -D -m644 "${srcdir}/httpd.service" "${pkgdir}/usr/lib/systemd/system/httpd.service"
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # symlinks for /etc/httpd
  # do we really need this symlink?
  ln -fs /usr/lib/httpd/modules "${pkgdir}/etc/httpd/modules"

  # set sane defaults
  sed -e 's#/usr/lib/httpd/modules/#modules/#' \
      -e 's|#\(LoadModule negotiation_module \)|\1|' \
      -e 's|#\(LoadModule include_module \)|\1|' \
      -e 's|#\(LoadModule userdir_module \)|\1|' \
      -e 's|#\(LoadModule slotmem_shm_module \)|\1|' \
      -e 's|#\(Include conf/extra/httpd-multilang-errordoc.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-autoindex.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-languages.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-userdir.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-default.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-mpm.conf\)|\1|' \
      -i "${pkgdir}/etc/httpd/conf/httpd.conf"

  # cleanup
  rm -r "${pkgdir}/usr/share/httpd/manual"
  rm -r "${pkgdir}/etc/httpd/conf/original"
  rm -r "${pkgdir}/srv/"
  rm -r "${pkgdir}/run"
}

prepare()

The prepare() part is quite interesting as we see what's happening ...

User replacement

First, we change the default user with the following...

# set default user
  sed -e 's#User daemon#User http#' \
      -e 's#Group daemon#Group http#' \
      -i docs/conf/httpd.conf.in

Indeed as we can see in the official apache Repository the default group and user are the following which shows us the first difference between Arch Linux and other distribution.

# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

Addition of the custom arch Layout

Before we continue with the following let me talk about Apache layouts. Apache includes by default it's own layout but also some layout according to different distributions. That is mainly why it's so different from a distribution to another. Indeed, Apache uses the file config.layout in order to allow custom directory and "architecture" structure according to the distribution.

In another word to quote the Apache wiki:

many third-party distributors change the layout to conform to local policies.

The default config.layout can be found here. Indeed as you can see Arch layout is not into the default config.layout file that's why we have the line:

cat "${srcdir}/arch.layout" >> config.layout
Let's compare Debian/Ubuntu layout with Arch layout

So here's the default Debian layout (at the time I write this)

<Layout Debian>
    prefix:
    exec_prefix:   ${prefix}/usr
    bindir:        ${exec_prefix}/bin
    sbindir:       ${exec_prefix}/sbin
    libdir:        ${exec_prefix}/lib
    libexecdir:    ${exec_prefix}/lib/apache2/modules
    mandir:        ${exec_prefix}/share/man
    sysconfdir:    ${prefix}/etc/apache2
    datadir:       ${exec_prefix}/share/apache2
    iconsdir:      ${datadir}/icons
    htdocsdir:     ${prefix}/usr/share/apache2/default-site/htdocs
    manualdir:     ${htdocsdir}/manual
    cgidir:        ${prefix}/usr/lib/cgi-bin
    includedir:    ${exec_prefix}/include/apache2
    localstatedir: ${prefix}/var/lock/apache2
    runtimedir:    ${prefix}/var/run/apache2
    logfiledir:    ${prefix}/var/log/apache2
    proxycachedir: ${prefix}/var/cache/apache2/proxy
    infodir:       ${exec_prefix}/share/info
    installbuilddir: ${prefix}/usr/share/apache2/build
    errordir:      ${datadir}/error
</Layout>

And here's Arch layout taken from the official arch package:

<Layout Arch>
    prefix:          /etc/httpd
    exec_prefix:     /usr
    bindir:          /usr/bin
    sbindir:         /usr/bin
    libdir:          /usr/lib/httpd
    libexecdir:      /usr/lib/httpd/modules
    mandir:          /usr/share/man
    sysconfdir:      /etc/httpd/conf
    datadir:         /usr/share/httpd
    installbuilddir: /usr/lib/httpd/build
    errordir:        /usr/share/httpd/error
    iconsdir:        /usr/share/httpd/icons
    htdocsdir:       /srv/http
    manualdir:       /usr/share/httpd/manual
    cgidir:          /srv/http/cgi-bin
    includedir:      /usr/include/httpd
    localstatedir:   /var
    runtimedir:      /run/httpd
    logfiledir:      /var/log/httpd
    proxycachedir:   /var/cache/httpd
</Layout>

I'm not going to details everything because I think that it's not necessarily as we can find more information into the documentation or elsewhere.

What we can see here is that it's pretty different. So this explains almost everything about the difference between Arch and Ubuntu/Debian Apache package.

build()

I searched what is the default configuration for Debian/Ubuntu but I didn't found anything sure so if you know, please feel free to add it and/or leave a comment to this part/answer.

The other most important thing is the way Apache is built and configured and that can be different from a distribution to another.

Arch Linux choose to configure it with the following which is I think should be different from Debian. You can find more about configure arguments here

./configure --sbindir=/usr/bin \
    --enable-layout=Arch \
    --enable-mpms-shared=all \
    --enable-modules=all \
    --enable-mods-shared=all \
    --enable-so \
    --enable-suexec \
    --with-suexec-caller=http \
    --with-suexec-docroot=/srv/http \
    --with-suexec-logfile=/var/log/httpd/suexec.log \
    --with-suexec-bin=/usr/bin/suexec \
    --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
    --enable-ldap --enable-authnz-ldap --enable-authnz-fcgi \
    --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache \
    --enable-ssl --with-ssl \
    --enable-deflate --enable-cgi --enable-cgid \
    --enable-proxy --enable-proxy-connect \
    --enable-proxy-http --enable-proxy-ftp \
    --enable-dbd --enable-imagemap --enable-ident --enable-cern-meta \
    --enable-lua --enable-xml2enc --enable-http2 \
    --with-apr=/usr/bin/apr-1-config \
    --with-apr-util=/usr/bin/apu-1-config \
    --with-pcre=/usr
0
3
  1. Start, Stop and Restart Apache 2 Web Server command is different on many Linux distros & Unix versions, as shown here (not the most up-to-date list, but anyway). This has historic reasons as well as some idiosyncratic reasons. Apart from the naming, the location, and the control commands, the Apache (2.x) webserver is pretty much the same on all current Linux versions when it comes to configuration, capabilities, etc.
  2. You can try to create shell scripts that mimic the commands you are more used to. Otherwise I don't think you can do very much.
4
  • The config system seems quite different, not just the commands. For an example, it doesn't seem to be possible to have multiple virtual host files, but you can put all the virtual hosts in one file Aug 12, 2017 at 1:21
  • You are right, instead of virtual host files arch uses the central /etc/httpd/conf/extra/httpd-vhosts.conf. However, the configuration of an individual host is pretty much the same.
    – wp78de
    Aug 12, 2017 at 4:21
  • the problem is i have some tools that rely on multiple virtual host files, and i would hate to abandon these tools if theres a way to avoid it Aug 12, 2017 at 4:47
  • 2
    We more and more deviate from the original question, but you can use the Include directive to include other config files and split up your main config as shown here: webmasters.stackexchange.com/questions/90690/…
    – wp78de
    Aug 12, 2017 at 8:05
0

I have never used Arch Linux myself, but your question intrigued me.

From reading the docs for AL and in particular their package manager, pacman, I get the impression that they have rather strict rules as to how things should be done, in accordance to their "Keep It Simple" mind set as seen on their front page. For example, have a look at their package standards; it's the first time I've seen such a standard for any Linux system. I wish other distributions had them (or made them more obvious).

As to getting an Ubuntu-flavored Apache2 onto AL, I'd say "don't". If they have a well functioning system for where things should be installed etc, I'd follow their recommendations and instead learn to use the system as-is. If you run into problems and ask for help chances are they'll just ask you to install the standard packages instead.

2
  • The Arch rules just boil down to "Don't do too much"; they're nowhere near as strict nor extensive as Ubuntu and Debian's. But similarly, Debian/Ubuntu have a pretty extensive set of Apache helpers, while Arch sticks with unaltered upstream layout for /etc/httpd. Aug 11, 2017 at 21:03
  • Agree, I would also argue you get a "stock" apache/httpd on arch.
    – wp78de
    Aug 12, 2017 at 4:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .