ラベル CentOS の投稿を表示しています。 すべての投稿を表示
ラベル CentOS の投稿を表示しています。 すべての投稿を表示

2017年3月17日金曜日

[CentOS][PostgreSQL]インストール

インストール

# yum install postgresql
# yum install postgresql-server

サービスの起動

# service postgresql start
postgresql サービスを開始中:            [  OK  ]

データベースクラスタの作成

# su - postgres
$ echo $PGDATA
/var/lib/pgsql/data
$ initdb --encoding=UTF8 --no-locale

ユーザー作成

  1. postgresユーザーに移行
    $ su -  postgres
    
  2. ユーザー作成
  3. $ createuser
    Enter name of role to add: xxxx
    Shall the new role be a superuser? (y/n) n
    Shall the new role be allowed to create databases? (y/n) y
    Shall the new role be allowed to create more new roles? (y/n) n
    CREATE ROLE
    

一般ユーザーの作成

  1. postgresユーザーに移行
    $ su -  postgres
    
  2. ユーザー作成
  3. $ createuser username
    
  4. ユーザーが作成されていることを確認する
    $ psql
    postgres=# SELECT usename,usesuper from pg_user;
      usename | usesuper
     ----------+----------
      postgres | t
      xxxx | f
    (2 rows)
    
    postgres=# \q
    

phpPgAdminのインストール

  1. phpPgAdminのインストール
    $ sudo yum install phpPgAdmin
    
  2. 設定
    1. postgresユーザーでログインできるように、/etc/phpPgAdmin/config.inc.phpを編集する。
      # vi /etc/phpPgAdmin/config.inc.php
      $conf['extra_login_security'] = false; ← trueをfalseに変更する
      
    2. PostgreSQL, httpdを再起動する。
      # service postgresql restart
      # service httpd restart
      
  3. 動作確認
    http://localhost/phpPgAdmin/にブラウザでアクセスする。

2016年1月7日木曜日

[CentOS] mp3gain インストール

  1. ソースコードをダウンロードする
    $ wget http://sourceforge.net/projects/mp3gain/files/mp3gain/1.5.2/mp3gain-1_5_2_r2-src.zip
  2. ダウンロードしたファイルを解凍する
    $ unzip mp3gain-1_5_2_r2-src.zip -d mp3gain
  3. Build
    $ sudo make
  4. Install
    $ sudo make install

[CentOS] avconv インストール

  1. 必要なパッケージをインストールする
    $ sudo yum install yasm
  2. ソースコードをダウンロードする
    $ wget https://libav.org/releases/libav-11.4.tar.gz
  3. ダウンロードしたファイルを解凍する
    tar zxvf libav-11.4.tar.gz
  4. Build
    $ cd libav-11.4
    $ ./configure
    $ sudo make
  5. Install
    $ sudo make install

[CentOS] lame インストール

  1. ソースコードをダウンロードする
    $ wget http://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz
  2. ダウンロードしたファイルを解凍する
    $ tar zxvf lame-3.99.5.tar.gz
  3. Build
    $ cd lame-3.99.5
    $ ./configure
    $ sudo make
  4. Install
    $ sudo make install

[CentOS] git

  • サーバーからファイルを取得
    1. $ git close git@bitbucket.org:xxxxx/xxxx.git directory
  • リモートレポジトリに commit
    1. $ git commit -a -F commitlog
      $ git push
  • 差分ファイル一覧表示
    1. $ git status -s
  • ファイルの追加
    1. $ git abc.txt

[CentOS] git インストール

$ sudo yum install git

[CentOS] フォルダ名を英語にする

「ダウンロード」や「ドキュメント」などのフォルダ名を英語に変更する。
  1. xdg-user-dirs-gtk-update を実行する
    $ LANG=C xdg-user-dirs-gtk-update
  2. 「Update standard folders to current language?」ダイアログが表示されたら Update Names を押す

[CentOS] Adobe flash player インストール

  1. Adobe Flash Player ダウンロード にアクセスする
  2. 「Linux 用 YUM (YUM)」を選択してダウンロードする
  3. ダウンロードしたファイルがあるフォルダに移動して Adobe リポジトリを追加する
    $ sudo yum localinstall adobe-release-x86_64-1.0-1.noarch.rpm
  4. flash-plugin をインストールする
    $ sudo yum install flash-plugin
  5. Firefox で flash が動作することを確認する

[CentOS] ngrep インストール

  1. EPEL repository をインストールする
    # yum install epel-release
  2. EPEL から ngrep をインストールする
    # yum --enablerepo=epel install ngrep

2015年4月23日木曜日

[CentOS][VirtualBox]共有フォルダー作成

  1. VirtualBox メニューの [デバイス] > [共有フォルダー設定]
  2. Windows (Host OS) に共有フォルダーを作成する (ユーザー\vbox_share)
  3. フォルダ追加アイコンを押す
  4. フォルダーのパス = 2. で作成したフォルダ
    自動マウント = On
    永続化する = On
  5. マウントする
    # mkdir /mnt/vbox_share
    # mount -t vboxsf vbox_share /mnt/vbox_share
    
  6. 動作確認
    1. Windows 側の vbox_share フォルダにファイルを置く
    2. CentOS で /mnt/vbox_share の中身を確認する
      $ ls /mnt/vbox_share
      test.txt
      
  7. 起動時に自動マウントするように /etc/rc.local にマウントコマンドを追記する(★が追記箇所)
    #!/bin/sh
    #
    # This script will be executed *after* all the other init scripts.
    # You can put your own initialization stuff in here if you don't
    # want to do the full Sys V style init stuff.
    
    touch /var/lock/subsys/local
    mount -t vboxsf vbox_share /mnt/vbox_share ★
    

[CentOS][VirtualBox]GNOME インストール

  1. インストール & 起動
    # yum groupinstall "X Window System" "GNOME Desktop Environment" "Desktop"
    $ startx
    
  2. GNOME インストール前に Guest Additions をインストールしていると X Window system 関連のインストールがスキップされているので、再インストールする
  3. GNOME terminal のフォントがずれているので修正する
    【修正前】

    【修正後】

    DejaVu Sans Mono フォントをインストールする
    # yum -y install dejavu-sans-mono-fonts
    

[CentOS][VirtualBox]Virtual Box Guest Additions インストール

  1. kernel の update、gcc, make, kernel-devel をインストールする
    # yum -y update kernel
    # yum -y install gcc make kernel-devel
    
  2. 再起動
  3. Guest Additions CD をマウントする
    # mkdir /mnt/cdrom
    # mount -r /dev/cdrom /mnt/cdrom
    
  4. Guest Additions CD のインストーラーをを実行する
    # cd /mnt/cdrom
    # ./VBoxLinuxAdditions.run
    

[CentOS][VirtualBox]ifconfig を実行すると eth0 が起動していない

  1. 起動時の設定ファイル /etc/sysconfig/network-scripts/ifcfg-eth0 を修正する
    【変更前】
    ONBOOT=no
    
    【変更後】
    ONBOOT=yes
    
  2. ネットワークを再設定
    # /etc/inet.d/network restart
    

2014年1月20日月曜日

[CentOS] Postfix (MTA: Mail transfer agent) インストール

  1. yum を使ってパッケージをインストールする
    # yum -y install postfix
  2. postfix の設定 (/etc/postfix/main.cf)
    • サーバーのホスト名を追加
      # INTERNET HOST AND DOMAIN NAMES
      #
      # The myhostname parameter specifies the internet hostname of this
      # mail system. The default is to use the fully-qualified domain name
      # from gethostname(). $myhostname is used as a default value for many
      # other configuration parameters.
      #
      #myhostname = host.domain.tld
      #myhostname = virtual.domain.tld
      myhostname = testserver.local ★
    • ドメイン名を追加
      # The mydomain parameter specifies the local internet domain name.
      # The default is to use $myhostname minus the first component.
      # $mydomain is used as a default value for many other configuration
      # parameters.
      #
      #mydomain = domain.tld
      mydomain = local ★
    • ローカルからメールを送る時に送信元メールアドレスの @ 以降に追加するドメイン名を指定
      # SENDING MAIL
      #
      # The myorigin parameter specifies the domain that locally-posted
      # mail appears to come from. The default is to append $myhostname,
      # which is fine for small sites.  If you run a domain with multiple
      # machines, you should (1) change this to $mydomain and (2) set up
      # a domain-wide alias database that aliases each user to
      # user@that.users.mailhost.
      #
      # For the sake of consistency between sender and recipient addresses,
      # myorigin also specifies the default domain name that is appended
      # to recipient addresses that have no @domain part.
      #
      myorigin = $myhostname ★
      #myorigin = $mydomain
    • メールボックス形式を Maildir にする
      # DELIVERY TO MAILBOX
      #
      # The home_mailbox parameter specifies the optional pathname of a
      # mailbox file relative to a user's home directory. The default
      # mailbox file is /var/spool/mail/user or /var/mail/user.  Specify
      # "Maildir/" for qmail-style delivery (the / is required).
      #
      #home_mailbox = Mailbox
      home_mailbox = Mail/ ★
    • 外部からのメール受信を許可する
      # The inet_interfaces parameter specifies the network interface
      # addresses that this mail system receives mail on.  By default,
      # the software claims all active interfaces on the machine. The
      # parameter also controls delivery of mail to user@[ip.address].
      #
      # See also the proxy_interfaces parameter, for network addresses that
      # are forwarded to us via a proxy or network address translator.
      #
      # Note: you need to stop/start Postfix when this parameter changes.
      #
      #inet_interfaces = all
      #inet_interfaces = $myhostname
      #inet_interfaces = $myhostname, localhost
      #inet_interfaces = localhost
      inet_interfaces = all ★
    • 自ドメイン宛メールを受信できるようにする
      # The mydestination parameter specifies the list of domains that this
      # machine considers itself the final destination for.
      #
      # These domains are routed to the delivery agent specified with the
      # local_transport parameter setting. By default, that is the UNIX
      # compatible delivery agent that lookups all recipients in /etc/passwd
      # and /etc/aliases or their equivalent.
      #
      # The default is $myhostname + localhost.$mydomain.  On a mail domain
      # gateway, you should also include $mydomain.
      #
      # Do not specify the names of virtual domains - those domains are
      # specified elsewhere (see VIRTUAL_README).
      #
      # Do not specify the names of domains that this machine is backup MX
      # host for. Specify those names via the relay_domains settings for
      # the SMTP server, or use permit_mx_backup if you are lazy (see
      # STANDARD_CONFIGURATION_README).
      #
      # The local machine is always the final destination for mail addressed
      # to user@[the.net.work.address] of an interface that the mail system
      # receives mail on (see the inet_interfaces parameter).
      #
      # Specify a list of host or domain names, /file/name or type:table
      # patterns, separated by commas and/or whitespace. A /file/name
      # pattern is replaced by its contents; a type:table is matched when
      # a name matches a lookup key (the right-hand side is ignored).
      # Continue long lines by starting the next line with whitespace.
      #
      # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
      #
      #mydestination = $myhostname, localhost.$mydomain, localhost
      mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
      #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
      #       mail.$mydomain, www.$mydomain, ftp.$mydomain
  3. sendmail を停止する
    # /etc/rc.d/init.d/sendmail stop
    sm-client を停止中:                                        [  OK  ]
    sendmail を停止中:                                         [  OK  ]
    # chkconfig sendmail off
    # chkconfig --list sendmail
    sendmail        0:off   1:off   2:off   3:off   4:off   5:off   6:off
  4. システムで使用するメールサーバー機能を sendmail から Postfix に切り替える
    # alternatives --config mta
    
    2 プログラムがあり 'mta' を提供します。
    
      選択       コマンド
    -----------------------------------------------
    *+ 1           /usr/sbin/sendmail.sendmail
       2           /usr/sbin/sendmail.postfix
    
    Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2
  5. Postfix 起動
    # /etc/rc.d/init.d/postfix start
    postfix を起動中:                                          [  OK  ]
  6. Postfix を自動起動するように設定する
    # chkconfig postfix on
    # chkconfig --list postfix
    postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off

2014年1月12日日曜日

[CentOS] vsftpd インストール

  1. yum を使ってパッケージをインストールする
    # yum -y install vsftpd
  2. vsftpd の設定 (/etc/vsftpd/vsftpd.conf)
    • 変更前
      # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
      anonymous_enable=YES
    • 変更後 (anonymous ユーザーのログインを禁止する)
      # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
      anonymous_enable=NO
  3. vsfptd 起動
    # /etc/rc.d/init.d/vsftpd start
    vsftpd 用の vsftpd を起動中:                               [  OK  ]
  4. vsftpd を自動起動するように設定する
    # chkconfig --list vsftpd
    vsftpd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
    # chkconfig vsftpd on
    # chkconfig --list vsftpd
    vsftpd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
  5. 動作確認
    FTP クライアントソフトを使用してサーバーに FTP 接続できることを確認する

[CentOS] yum で proxy を使う

  1. /etc/yum.conf に以下を記載
    # proxy setting
    proxy=http://proxyserver.local:8080
    proxy_username=username
    proxy_password=password
  2. 動作確認
    # yum update