{"id":499,"date":"2014-02-07T10:39:42","date_gmt":"2014-02-07T01:39:42","guid":{"rendered":"http:\/\/www.otwo.jp\/blog\/?p=499"},"modified":"2015-01-13T19:10:07","modified_gmt":"2015-01-13T10:10:07","slug":"rpm-server","status":"publish","type":"post","link":"https:\/\/www.otwo.jp\/blog\/rpm-server\/","title":{"rendered":"chef-solo\u3067\u4f7f\u3046rpm\u306e\u914d\u4fe1\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3066\u3066\u307f\u308b"},"content":{"rendered":"<p>\u958b\u767a\uff12\u90e8\u306e\u5409\u5ca1\u3067\u3059\u3002<\/p>\n<p>\u73fe\u5728\u3001\u958b\u767a\u74b0\u5883\u3092\u3069\u3093\u306a\u611f\u3058\u3067\u69cb\u7bc9\u3057\u3088\u3046\u304b\u3068\u8003\u3048\u4e2d\u3067\u3059\u304c\u3001\u5404\u6240\u3067\u8a71\u984c\u306echef-solo\u3068Vagrant\u3092\u4f7f\u3063\u3066\u6311\u6226\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u3093\u3060\u304b\u3093\u3060\u30673\u56de\u306b\u5206\u3051\u3066\u63b2\u8f09\u3057\u3066\u3044\u3053\u3046\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p><!--\n\n<hr \/>\n\n--><\/p>\n<p>\u3072\u3068\u307e\u305a\u3001\u958b\u767a\u74b0\u5883\u3092\u3068\u3057\u3066\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u6b32\u3057\u3044\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u5404\u958b\u767a\u30b9\u30bf\u30c3\u30d5\u304c\u624b\u65e9\u304f\u958b\u767a\u74b0\u5883\u3092\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002\u601d\u3044\u7acb\u3063\u305f\u3089\u5373\u74b0\u5883\u3092\u30b2\u30c3\u30c8\u51fa\u6765\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3067\u3059\u3002<\/li>\n<li>\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306e\u5909\u66f4\u306a\u3069\u3001\u958b\u767a\u74b0\u5883\u306e\u5909\u5316\u3082\u5404\u30b9\u30bf\u30c3\u30d5\u3067\u5171\u6709\u51fa\u6765\u308b\u3088\u3046\u306b\u3059\u308b\u3002\u5404\u30b9\u30bf\u30c3\u30d5\u304c\u306a\u308b\u3079\u304f\u540c\u3058\u74b0\u5883\u3092\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3067\u3059\u3002<\/li>\n<li>\u672c\u756a\u74b0\u5883\u3082\u8003\u3048\u305f\u74b0\u5883\u3092\u4f7f\u7528\u3057\u305f\u3044\u3002\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u7b49\u3001\u672c\u756a\u3067\u4f7f\u7528\u3059\u308b\u3082\u306e\u3068\u51fa\u6765\u308b\u3060\u3051\u540c\u3058\u306b\u3057\u305f\u3044\u3067\u3059\u3002<\/li>\n<li>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7d42\u4e86\u5f8c\u3067\u3082\u3001\u74b0\u5883\u3092\u5fa9\u65e7\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002\u7d0d\u54c1\u5f8c\u3067\u3082\u52d5\u4f5c\u74b0\u5883\u3092\u4fdd\u6301\u3057\u3066\u304a\u3044\u3066\u3001\u691c\u8a3c\u3084\u554f\u3044\u5408\u308f\u305b\u5bfe\u5fdc\u7b49\u306e\u4f5c\u696d\u3092\u884c\u3044\u3084\u3059\u304f\u3057\u305f\u3044\u3067\u3059\u3002<\/li>\n<\/ol>\n<h1>chef-solo\u30fbVagrant<\/h1>\n<p>\u3067\u3001chef-solo\u3068Vagrant\u3068\u306f\u4f55\u304b\u3068\u8a00\u3046\u3068\u3001<\/p>\n<ul>\n<li>chef-solo:\u30b5\u30fc\u30d0\u30fc\u306e\u69cb\u6210\u7ba1\u7406\u30c4\u30fc\u30eb\u3067\u3059\u3002\u3069\u306e\u3088\u3046\u306b\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3059\u308b\u306e\u304b\u5b9a\u7fa9\u3057\u3001\u7ba1\u7406\u3057\u3066\u304a\u3051\u307e\u3059\u3002<br \/>\n\u5404\u7a2e\u306e\u8a2d\u5b9a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u74b0\u5883\u6bce\u306b\u5b9a\u7fa9\u3057\u305f\u308a\u3068\u3001\u4f55\u304b\u3068\u4fbf\u5229\u306a\u6a5f\u80fd\u304c\u6e80\u8f09\u3067\u3059\u3002<\/li>\n<li>Vagrant:\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3092\u624b\u8efd\u306b\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u30c4\u30fc\u30eb\u7fa4\u3001\u3068\u8a00\u3063\u305f\u611f\u3058\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u69cb\u7bc9\u3057\u305f\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u3092\u914d\u5e03\u3057\u305f\u308a\u3001\u307e\u305f\u7834\u68c4\u3057\u305f\u308a\u3068\u3044\u3046\u3053\u3068\u304c\u7c21\u5358\u306b\u51fa\u6765\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3059\u3054\u304f\u3056\u3063\u304f\u308a\u306a\u8aac\u660e\u3067\u3059\u304c\u3001\u8a73\u7d30\u306a\u8aac\u660e\u306f\u8272\u3005\u306a\u3068\u3053\u308d\u3067\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u7701\u7565\u3057\u307e\u3059\u3002<\/p>\n<p><!--\n\n<hr \/>\n\n--><\/p>\n<h1>chef-solo\u306e\u30ec\u30b7\u30d4\u306b\u3064\u3044\u3066<\/h1>\n<p>\u3044\u3064chef\u3092\u52d5\u304b\u3057\u3066\u3082\u3001\u540c\u3058\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u306e\u3067\u3001\u57fa\u672c\u7684\u306brpm\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u6700\u521d\u306b\u5404\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306erpm\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304a\u304d\u3001\u3053\u308c\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u540c\u3058\u74b0\u5883\u3092\u518d\u73fe\u3059\u308b\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u5404rpm\u306f\u6b21\u306e\u3088\u3046\u306byum\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u51fa\u6765\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash\r; notranslate\"># yum install --downloadonly --downloaddir=\/tmp\/ httpd\r\n<\/pre>\n<p>yum\u30b3\u30de\u30f3\u30c9\u306b\u300c&#8211;downloadonly\u300d\u3068\u3044\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u3001\u300c&#8211;downloaddir\u300d\u3067\u4fdd\u5b58\u5148\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>downloadonly\u306a\u3093\u3066\u30aa\u30d7\u30b7\u30e7\u30f3\u306d\u30fc\u3088\u3001\u3068yum\u306b\u6012\u3089\u308c\u308b\u5834\u5408\u306f<\/p>\n<pre class=\"brush: bash\r; notranslate\"># yum install yum-plugin-downloadonly\r\n<\/pre>\n<p>\u3068\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><!--\n\n<hr \/>\n\n--><\/p>\n<h1>rpm\u306f\u3069\u3053\u306b\u7f6e\u304f\uff1f<\/h1>\n<p>\u3068\u3001rpm\u3092\u304b\u304d\u96c6\u3081\u308b\u306e\u306f\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u3092\u3069\u3053\u306b\u7f6e\u304f\u304b\u304c\u554f\u984c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u793e\u5185LAN\u4e0a\u306b\u7c21\u6613\u306aWeb\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u3066\u3001rpm\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3059\u308c\u3070\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u51fa\u6765\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3046\u3044\u3046\u6642\u306b\u5f79\u306b\u7acb\u3064\u306e\u304c<a href=\"http:\/\/www.tornadoweb.org\/\">Tornado<\/a>\u3067\u3059\u3002<br \/>\npython\u88fd\u306eWeb\u30b5\u30fc\u30d0\u30fc\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u304c\u3001\u7c21\u5358\u306b\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u4f5c\u3063\u3066\u307f\u305fWeb\u30b5\u30fc\u30d0\u30fc\u306e\u30b3\u30fc\u30c9\u306f\u2193\u3067\u3059\u3002<\/p>\n<p>web.py<\/p>\n<pre class=\"brush: python\r; notranslate\"># -*- coding: utf-8 -*-\r\n\r\nimport re\r\nimport os\r\n\r\nimport tornado.httpserver\r\nimport tornado.ioloop\r\nimport tornado.options\r\nimport tornado.web\r\nfrom tornado.options import define, options\r\n\r\nBASE_DIR = os.getcwd()\r\nHTTP_PORT = 8095\r\n\r\n######\r\nclass Output(tornado.web.RequestHandler):\r\n    def get(self, middleware_package, rpm):\r\n        try:\r\n            self.set_header('Content-Type', 'application\/octet-stream')\r\n            self.set_header('Content-Disposition', 'attachment; filename=' + rpm)\r\n            buf_size = 4096\r\n\r\n            file_name = '%s\/%s\/%s\/%s' % ( BASE_DIR , 'rpm', middleware_package, rpm)\r\n            with open(file_name, 'r') as f:\r\n                while True:\r\n                    data = f.read(buf_size)\r\n                    if not data:\r\n                        break\r\n                    self.write(data)\r\n            self.finish()\r\n\r\n        except Exception, e:\r\n            self.write(e.message)\r\n\r\n######\r\nclass Application(tornado.web.Application):\r\n    def __init__(self):\r\n        handlers=[\r\n                    (r\"^\/rpm\/([a-z0-9\\-]+)\/(.+.rpm)$\",Output),\r\n                ]\r\n\r\n        settings=dict(\r\n                debug=False,\r\n                )\r\n\r\n        tornado.web.Application.__init__(self,handlers,**settings)\r\n\r\n######\r\ndefine(\"port\", default=HTTP_PORT, type=int)\r\n\r\nif __name__==\"__main__\":\r\n    tornado.options.parse_command_line()\r\n    http_server=tornado.httpserver.HTTPServer(Application())\r\n    http_server.listen(options.port)\r\n\r\n    io_loop = tornado.ioloop.IOLoop.instance()\r\n    io_loop.start()\r\n<\/pre>\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3068\u3057\u3066\u306f<\/p>\n<pre>\u2533web.py\r\n\u2517rpm\r\n\u3000\u2523httpd\r\n\u3000\u2503\u2517\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305frpm\u30d5\u30a1\u30a4\u30eb\r\n\u3000\u2523php\r\n\u3000\u2503\u2517 \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305frpm\u30d5\u30a1\u30a4\u30eb\r\n\u3000\u2517mysql\r\n\u3000\u3000\u2517 \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305frpm\u30d5\u30a1\u30a4\u30eb<\/pre>\n<p>\u3068\u3044\u3046\u611f\u3058\u3067\u3059\uff08httpd\u3001php\u3001mysql\u306erpm\u3092\u63d0\u4f9b\u3059\u308b\u5834\u5408\uff09\u3002<\/p>\n<p>\u300crpm\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u306b\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u540d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u3042\u308a\u3001rpm\u30d5\u30a1\u30a4\u30eb\u3092\u683c\u7d0d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash\r; notranslate\"># pip install tornado\r\n<\/pre>\n<p>\u3057\u3066\u3001<br \/>\nrpm\/\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u540d\/ \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e0b\u306brpm\u30d5\u30a1\u30a4\u30eb\u3092\u683c\u7d0d\u3057<\/p>\n<pre class=\"brush: bash\r; notranslate\">$ python .\/web.py\r\n<\/pre>\n<p>\u3059\u308c\u3070\u3001web\u30b5\u30fc\u30d0\u30fc\u304c\u7acb\u3061\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u3001<br \/>\nhttp:\/\/\u30db\u30b9\u30c8\u540d:8095\/rpm\/\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u540d\/rpm\u30d5\u30a1\u30a4\u30eb\u540d<br \/>\n\u3092\u6307\u5b9a\u3059\u308c\u3070rpm\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u308b\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070<br \/>\nhttp:\/\/127.0.0.1:8095\/rpm\/httpd\/apr\u20131.3.9\u20135.el6_2.x86_64.rpm<br \/>\n\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>python\u306f\u30c9\u7d20\u4eba\u72b6\u614b\u3067\u3059\u304c\u3001\u671b\u3093\u3067\u3044\u308b\u3082\u306e\u306f\u306a\u3093\u3068\u304b\u51fa\u6765\u307e\u3057\u305f\u2026<\/p>\n<p><!--\n\n<hr>\n\n--><\/p>\n<p>\u6b21\u56de\u306fChef\u306e\u30ec\u30b7\u30d4\u4f5c\u6210\u3092\u884c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u958b\u767a\uff12\u90e8\u306e\u5409\u5ca1\u3067\u3059\u3002 \u73fe\u5728\u3001\u958b\u767a\u74b0\u5883\u3092\u3069\u3093\u306a\u611f\u3058\u3067\u69cb\u7bc9\u3057\u3088\u3046\u304b\u3068\u8003\u3048\u4e2d\u3067\u3059\u304c\u3001\u5404\u6240\u3067\u8a71\u984c\u306echef-solo\u3068Vagrant\u3092\u4f7f\u3063\u3066\u6311\u6226\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u306a\u3093\u3060\u304b\u3093\u3060\u30673\u56de\u306b\u5206\u3051\u3066\u63b2\u8f09\u3057\u3066\u3044\u3053\u3046\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":11,"featured_media":609,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[15,13,14],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/499"}],"collection":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/comments?post=499"}],"version-history":[{"count":31,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":1188,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/499\/revisions\/1188"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/media\/609"}],"wp:attachment":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/categories?post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/tags?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}