Sunday, August 26, 2007

Web access authentication setup

  1. Create user passwd file: "htpasswd -c /etc/httpd/userfile username"; if "-c" flag is included, existing file will be overwritten, so no need for it when adding extra users.
  2. Insert directive in httpd.conf file:

    • AuthName "Restricted Area"
    • AuthType Basic
    • AuthUserFile /etc/httpd/users
    • require valid-user

Monday, August 20, 2007

Setting up Gallery on Home Linux

  • Apache server: already installed on my server, but not automatically started.
  • PHP:
    • in order to compile PHP, we need "apxs", use "yum install httpd-devel" to get it installed.
    • It turns out that I don't need to compile PHP anyway, since it is already available. The only thing is that php.ini is located under /etc instead of /user/local/lib.
    • I checked all the settings suggested on gallery website. All seems fine except that "gettext" option is not available. Leave it open for now since I may not need the functionality provided by gettext.
  • Mysql: (use "yum search mysql" to find all packages related to mysql)
    • "yum install mysql mysql-server php-mysql mysql-devel", Mysql 5 is installed.
  • Image Libraries
    • yum install netpbm ImageMagick gd GraphicsMagick
  • Gallery
    • yum install gallery2
    • The gallery package is installed under /usr/share, I have to create a symbolic link in the web server directory:
      • ln -s /usr/share/gallery2 /var/www/html/gallery
  • Optional packages
    • yum install gallery2-ffmpeg jhead
    • dcraw already installed
  • Load up the gallery web page and follow the steps to finish install
    • If need to check PHP setting, then a simple php file containing "" can be used to show all the info on a web page.
    • Step 4, can not set my own directory (even if I chmod 777 on whatever directories created, the installation complains about not being able to access it); so have to use the default
    • Step 5, database setup
      • mysql_install_db: run this to initialize database
      • myql tables are located under /var/lib/mysql. "cd /var/lib/mysql; chown -R mysql:mysql mysql test"; otherwise, mysqld cannot be started because the owner of those directories is root.
      • "mysqld_safe --user=mysql &": start mysql server
      • "mysqladmin version": check mysql is running
      • "mysqladmin -u root create gallery2": create db for gallery
      • "GRANT ALL PRIVILEGES ON gallery2.* TO 'user'@'domain' IDENTIFIED BY 'pass'" after login in to mysql as root "mysql -u root"
      • Installer complains about not able to access database
      • Login in as root to mysql and use the following command to check user info:
        • connect mysql;
        • select * from user;
      • try "FLUSH PRIVILEGES" or restart mysql server "mysqladmin shutdown", but neither works.
      • try to recompile PHP "configure --with-apxs2 --with-mysql --with-gd --with-bz2 --with-curl --with-pic --with-png"; does not work either
      • It turns out that context for SELinux is not set up properly to allow httpd to write to the socket, error message can be found in /var/log/message. I disabled SELinux for now (change /etc/sysconfig/selinux).
    • Everything else works fine just following the steps.