{"id":795,"date":"2023-03-11T20:50:44","date_gmt":"2023-03-11T11:50:44","guid":{"rendered":"https:\/\/wp.zassoul.com\/?p=795"},"modified":"2023-03-11T20:50:44","modified_gmt":"2023-03-11T11:50:44","slug":"phpipam%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/wp.zassoul.com\/?p=795","title":{"rendered":"phpIPAM\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30e1\u30e2"},"content":{"rendered":"\n<p>IPAM: IP Address Management<\/p>\n\n\n\n<p>\u305d\u306e\u540d\u306e\u901a\u308a\u30a2\u30c9\u30ec\u30b9\u7ba1\u7406\u30c4\u30fc\u30eb\u3067\uff0c\u4ee5\u524dNetBox\u3092\u9063\u3063\u3066\u307f\u305f\u304c\u30a2\u30c9\u30ec\u30b9\u7ba1\u7406\u3060\u3051\u306b\u7126\u70b9\u3092\u3042\u3066\u308b\u3068 too much\u306a\u611f\u3058\u3060\u3063\u305f\u306e\u3067\u5225\u306e\u3082\u306e\u3092\u63a2\u3057\u3066\u3044\u305f\u3002<\/p>\n\n\n\n<p>\u305d\u3053\u3067<a href=\"https:\/\/phpipam.net\/\" data-type=\"URL\" data-id=\"https:\/\/phpipam.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">phpipam<\/a>\u3092\u898b\u304b\u3051\u305f\u306e\u3067\u8a66\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u7d50\u8ad6\u304b\u3089\u3044\u3046\u3068\uff0c\u3053\u3061\u3089\u306e\u307b\u3046\u304c\u81ea\u5206\u306b\u306f\u5408\u3063\u3066\u3044\u305f\u3002<\/p>\n\n\n\n<p>OpenStack\u306bMiracleLinux9\u3092\u305f\u3066\uff0c\u305d\u3053\u3078\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8b\u524d\u6e96\u5099<\/h2>\n\n\n\n<p>\u5fc5\u8981\u8981\u4ef6\u3092\u78ba\u8a8d\u3002\u6b63\u76f4PHP\u306a\u3069\u89e6\u3063\u305f\u3053\u3068\u3082\u7121\u3044\u306e\u3067\u826f\u304f\u308f\u304b\u3089\u306a\u3044\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/phpipam.net\/documents\/installation\/\">https:\/\/phpipam.net\/documents\/installation\/<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Webserver (\u4eca\u56de\u306fnginx \u306b\u3057\u305f)<\/li>\n\n\n\n<li>Mysql server (Mariadb)<\/li>\n\n\n\n<li>PHP<\/li>\n\n\n\n<li>PHP module<\/li>\n\n\n\n<li>php PEAR<\/li>\n<\/ul>\n\n\n\n<p>\u307e\u305a\u4e0a\u8a18\u542b\u3081\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u5fc5\u8981\u306a\u3082\u306e\u3092\u6e96\u5099\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dnf install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-9.noarch.rpm\n# dnf install nginx\n# dnf install mariadb-server \n# dnf install php\n# dnf install php-{pdo,pdo_mysql,session,sockets,openssl,gmp,ldap,xml,json,gettext,filter,pcntl,pear,gd}\n# dnf install git\n# systemctl enable nginx php-fpm mariadb\n# systemctl start nginx php-fpm mariadb<\/code><\/pre>\n\n\n\n<p>phpipam\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># git clone  --recursive https:\/\/github.com\/phpipam\/phpipam.git \/var\/www\/phpipam\n# cd \/var\/www\/phpipam\n# git checkout -b 1.5 origin\/1.5\n# chown -R nginx:nginx \/var\/www\/<\/code><\/pre>\n\n\n\n<p>Mariadb\u521d\u671f\u8a2d\u5b9a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mysql_secure_installation\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\n\nIn order to log into MariaDB to secure it, we'll need the current\npassword for the root user. If you've just installed MariaDB, and\nhaven't set the root password yet, you should just press enter here.\n\nEnter current password for root (enter for none):\nOK, successfully used password, moving on...\n\nSetting the root password or using the unix_socket ensures that nobody\ncan log into the MariaDB root user without the proper authorisation.\n\nYou already have your root account protected, so you can safely answer 'n'.\n\nSwitch to unix_socket authentication &#91;Y\/n] y\nEnabled successfully!\nReloading privilege tables..\n ... Success!\n\n\nYou already have your root account protected, so you can safely answer 'n'.\n\nChange the root password? &#91;Y\/n] y\nNew password:\nRe-enter new password:\nPassword updated successfully!\nReloading privilege tables..\n ... Success!\n\n\nBy default, a MariaDB installation has an anonymous user, allowing anyone\nto log into MariaDB without having to have a user account created for\nthem.  This is intended only for testing, and to make the installation\ngo a bit smoother.  You should remove them before moving into a\nproduction environment.\n\nRemove anonymous users? &#91;Y\/n] y\n ... Success!\n\nNormally, root should only be allowed to connect from 'localhost'.  This\nensures that someone cannot guess at the root password from the network.\n\nDisallow root login remotely? &#91;Y\/n] y\n ... Success!\n\nBy default, MariaDB comes with a database named 'test' that anyone can\naccess.  This is also intended only for testing, and should be removed\nbefore moving into a production environment.\n\nRemove test database and access to it? &#91;Y\/n] y\n - Dropping test database...\n ... Success!\n - Removing privileges on test database...\n ... Success!\n\nReloading the privilege tables will ensure that all changes made so far\nwill take effect immediately.\n\nReload privilege tables now? &#91;Y\/n] y\n ... Success!\n\nCleaning up...\n\nAll done!  If you've completed all of the above steps, your MariaDB\ninstallation should now be secure.\n\nThanks for using MariaDB!<\/code><\/pre>\n\n\n\n<p>ipam\u7528DB\u30e6\u30fc\u30b6\u4f5c\u6210\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mysql -u root -p\r\nEnter password:\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 13\r\nServer version: 10.5.16-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nMariaDB &#91;(none)]> create database phpipam;\r\nQuery OK, 1 row affected (0.000 sec)\r\n\r\nMariaDB &#91;(none)]> GRANT ALL on phpipam.* to phpipam@localhost identified by 'PASSWORD';\r\nQuery OK, 0 rows affected (0.050 sec)\r\n\r\nMariaDB &#91;(none)]> exit\r\nBye<\/code><\/pre>\n\n\n\n<p>\u30b9\u30ad\u30fc\u30de\u53d6\u308a\u8fbc\u307f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mysql -u root -p phpipam &lt; .\/db\/SCHEMA.sql<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u7de8\u96c6<\/h2>\n\n\n\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cp \/var\/www\/phpipam\/config.dist.php \/var\/www\/phpipam\/config.php<\/code><\/pre>\n\n\n\n<p>DB\u8a8d\u8a3c\u95a2\u9023\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u7de8\u96c6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vi \/var\/www\/phpipam\/config.php\n\/**\r\n * database connection details\r\n ******************************\/\r\n$db&#91;'host'] = '127.0.0.1';\r\n$db&#91;'user'] = 'phpipam';\r\n$db&#91;'pass'] = 'phpipamadmin';\r\n$db&#91;'name'] = 'phpipam';\r\n$db&#91;'port'] = 3306;\n\n\n\/***\n \u3053\u306e\u307e\u307e\u3044\u304f\u3068\u4ee5\u4e0b\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u308b\u306e\u3067PHP\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30b5\u30dd\u30fc\u30c8\u5916\u3067\u3082\u8d77\u52d5\u3055\u305b\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u5165\u308c\u308b \nDetected PHP version: 8.0.27 >= 8.0\n***\/\n\r$allow_untested_php_versions=true;\n<\/code><\/pre>\n\n\n\n<p>php.ini\u306e\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u3092\u8a2d\u5b9a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vim \/etc\/php.ini\n&#91;Date]\r\n; Defines the default timezone used by the date functions\r\n; http:\/\/php.net\/date.timezone\r\ndate.timezone = Asia\/Tokyo<\/code><\/pre>\n\n\n\n<p>nginx\u5468\u308a\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u7de8\u96c6\u3002<\/p>\n\n\n\n<p>\/etc\/nginx\/nginx.conf \u306e\u30b5\u30fc\u30d0\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vi \/etc\/nginx\/nginx.conf\n#    server {\r\n#        listen       80;\r\n#        listen       &#91;::]:80;\r\n#        server_name  _;\r\n#        root         \/usr\/share\/nginx\/html;\r\n#\r\n#        # Load configuration files for the default server block.\r\n#        include \/etc\/nginx\/default.d\/*.conf;\r\n#\r\n#        error_page 404 \/404.html;\r\n#        location = \/404.html {\r\n#        }\r\n#\r\n#        error_page 500 502 503 504 \/50x.html;\r\n#        location = \/50x.html {\r\n#        }\r\n#    }<\/code><\/pre>\n\n\n\n<p>phpipam\u7528\u306b\u4ee5\u4e0b\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u3002<a rel=\"noreferrer noopener\" href=\"https:\/\/wp.zassoul.com\/?page_id=799\" data-type=\"page\" data-id=\"799\" target=\"_blank\">\u516c\u5f0f<\/a>\u53c2\u7167\u3057\u3064\u3064\u30b0\u30b0\u3063\u305f\u7d50\u679c\u3092\u3082\u3068\u306b\u9069\u5b9c\u4fee\u6b63\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vi \/etc\/nginx\/conf.d\/phpipam.conf\nserver {\n    # root directory\n    root   \/var\/www\/phpipam\/;\n   \n    # phpipam\n    location \/ {\n        try_files $uri $uri\/ index.php;\n        index index.php;\n    }\n    # phpipam - api\n    location \/api\/ {\n        try_files $uri $uri\/ \/api\/index.php;\n    }\n\n    # php-fpm\n    location ~ \\.php$ {\n        fastcgi_pass   unix:\/var\/run\/php-fpm\/www.sock;\n        fastcgi_index  index.php;\n        try_files      $uri $uri\/ index.php = 404;\n        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        include        fastcgi_params;\n    }\n }<\/code><\/pre>\n\n\n\n<p>php-fpm.conf \u306e\u30bd\u30b1\u30c3\u30c8\u306e\u30d1\u30b9\u3092\u9069\u5207\u306b\u4fee\u6b63\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vi \/etc\/nginx\/conf.d\/php-fpm.conf\n# PHP-FPM FastCGI server\r\n# network or unix domain socket configuration\r\n\r\nupstream php-fpm {\r\n        server unix:\/var\/run\/php-fpm\/www.sock;\r\n}<\/code><\/pre>\n\n\n\n<p>\u30a2\u30af\u30bb\u30b9\u8a31\u53ef<\/p>\n\n\n\n<p>SELinux\u3068firewalld\u3067HTTP(80)\u3092\u8a31\u53ef\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># firewall-cmd --add-service=http --zone=public --permanent\n# firewall-cmd --reload\n# sudo setsebool -P httpd_can_network_connect 1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u521d\u671f\u8a2d\u5b9a<\/h2>\n\n\n\n<p>\u3053\u308c\u3067http:\/\/ipaddress\/ \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u4ee5\u4e0b\u753b\u9762\u304c\u51fa\u3066\u521d\u671f\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u306b\u5165\u308b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"928\" height=\"743\" src=\"https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/phpipam01.png\" alt=\"\" class=\"wp-image-803\" srcset=\"https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/phpipam01.png 928w, https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/phpipam01-300x240.png 300w, https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/phpipam01-768x615.png 768w\" sizes=\"auto, (max-width: 928px) 100vw, 928px\" \/><\/figure>\n\n\n\n<p>\u30dd\u30c1\u30dd\u30c1\u3084\u3063\u3066\u3044\u304f\u3068\u521d\u671f\u30d1\u30b9\u3067\u30ed\u30b0\u30a4\u30f3\u2192\u30d1\u30b9\u5909\u66f4\u2192\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3078\u3068\u9077\u79fb\u3059\u308b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"252\" src=\"https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/image-1024x252.png\" alt=\"\" class=\"wp-image-804\" srcset=\"https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/image-1024x252.png 1024w, https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/image-300x74.png 300w, https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/image-768x189.png 768w, https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/image-1536x378.png 1536w, https:\/\/wp.zassoul.com\/wp-content\/uploads\/2023\/03\/image-2048x504.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u3053\u308c\u3067\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u306f\u5b8c\u4e86\u3002\u5f8c\u306fIP\u30a2\u30c9\u30ec\u30b9\u7ba1\u7406\u306e\u305f\u3081\u306e\u6e96\u5099\u3068\u306a\u308b\u304c\u5272\u611b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IPAM: IP Address Management \u305d\u306e\u540d\u306e\u901a\u308a\u30a2\u30c9\u30ec\u30b9\u7ba1\u7406\u30c4\u30fc\u30eb\u3067\uff0c\u4ee5\u524dNetBox\u3092\u9063\u3063\u3066\u307f\u305f\u304c\u30a2\u30c9\u30ec\u30b9\u7ba1\u7406\u3060\u3051\u306b\u7126\u70b9\u3092\u3042\u3066\u308b\u3068 too much\u306a\u611f\u3058\u3060\u3063\u305f\u306e\u3067\u5225\u306e\u3082\u306e\u3092\u63a2\u3057\u3066\u3044\u305f\u3002 \u305d\u3053\u3067ph\u2026 <span class=\"read-more\"><a href=\"https:\/\/wp.zassoul.com\/?p=795\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,15],"tags":[107,77,75,108],"class_list":["post-795","post","type-post","status-publish","format-standard","hentry","category-linux","category-network","tag-ipam","tag-linux","tag-network","tag-phpipam"],"_links":{"self":[{"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=\/wp\/v2\/posts\/795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=795"}],"version-history":[{"count":8,"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":806,"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=\/wp\/v2\/posts\/795\/revisions\/806"}],"wp:attachment":[{"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.zassoul.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}