First VPS #6 : To create a repository for my own.

   I want to configure my system with event + suEXEC + FPM on さくらの VPS.
   For that I rebuilt php.rpms with ‘--enable-fpm’, but I got fed up with all the dependency things when I used ‘rpm -ivh’. So I decided to create a repository for my own, ha-ha.

    On the VPS

  1. $ sudo adduser --gid xxxx myrepo
    ‘myrepo’ is a user for the repository and ‘xxxx’ is the gid of the httpd user group.
    $ sudo passwd myrepo
  2. $ sudo chmod 710 /home/myrepo
  3. $ sudo su - myrepo
  4. $ mkdir public_html
  5. $ cd public_html
  6. $ mkdir x86_64
  7. $ exit

   I haven’t written it yet, but I already configure Apache httpd for suEXEC Support. So I have new User and Group on the httpd.conf. If you use the settings on this post for your repository, read my words about httpd configuration on the post as your words on your system.
 
   I removed ‘Options Indexes’ from the httpd conf files, but want to show the indexes of the repository directory. For that I need to use ‘Options Indexes’ in the .htaccess file. So I did the following things.

    About httpd on the VPS

  1. Change the followings about the userdir.conf (/etc/httpd/conf.d/userdir.conf).
    UserDir enabled normuser1 —>> UserDir enabled normuser1 myrepo
        ↑ This is not for .htaccess but for the user ‘myrepo’.
    AllowOverride FileInfo AuthConfig Limit Indexes
    —>> AllowOverride FileInfo AuthConfig Limit Indexes Options=Indexes
  2. $ sudo systemctl restart httpd.service
  3. $ sudo su - myrepo
  4. $ cd public_html/x86_64
  5. $ vi .htaccess
    Its text is ‘Options Indexes’.
  6. $ chmod 640 .htaccess
  7. $ exit
    On the VM for development environment.

  1. Log on as the user ‘rpmbuilder’ and rebuild all the rpm files I want.
     
    Note 1) On the post ‘First VPS #5’, I wrote how to rebuild php.rpm. That’s nothing wrong, but yum gives ‘Package PACKAGE_NAME.rpm is not signed’ when I used my repository. We need a signature for rpm files when we use them by yum though we can avoid it by the option ‘--nogpgcheck’ and I used the option for my filezilla.rpm installation.
  2. Add my signature to the rpm files.
    $ rpm --addsign rpmbuild/RPMS/x86_64/*
     
    Of course, I need GPG Keys before this step.

    • Log on the VM as a root privilege user.
      $ sudo gpg --gen-key
      $ sudo gpg --export -a 'o6asan' > RPM-GPG-KEY-o6asan
      RPM-GPG-KEY-o6asan is my public key file. I upload this to /x86_64 in myrepo’s DocumentRoot on the VPS by Filezilla client.
      $ sudo gpg -o file.secret --export-secret-key o6asan
      file.secret is my private key file. I move this to rpmbuilder’s home directory.
      $ sudo mv /home/vmowner/file.secret /home/rpmbuilder/file.secret
    • Log on the VM as the user ‘rpmbuilder’
      $ gpg --import file.secret
      This command imports both secret and public keys.
       
      $ vi .rpmmacros
      Add the next two lines.
      %_signature gpg
      %_gpg_name <Owner name>
       
      Note 2) Actually, I wanted to create the keys as ‘rpmbuilder’ because I rebuild the rpm files as ‘rpmbuilder’. But I couldn’t. To create GPG Keys requires root privilege.
  3. Upload all the rpm files to /x86_64 in myrepo’s DocumentRoot on the VPS.
  4. On the VPS.
    $ sudo yum install createrepo
    $ sudo createrepo /path to/x86_64

   Now, I have a repository for my own and the URL is http://www17130ue.sakura.ne.jp/~myrepo/x86_64/.
   I’ll write ‘How to use the repository for my own’ for the next post.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.