laferrierejc

docker xampp wordpress

Mar 5th, 2017
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. #xampp
  2. #https://premium.wpmudev.org/blog/setting-up-xampp/
  3.  
  4. mv /opt/lampp/htdocs/wordpress/wp-config-sample.php /opt/lampp/htdocs/wordpress/wp-config.php
  5.  
  6. Replace“database_name_here” with the name of your database, which in my case is “WP”
  7.  
  8. Replace “username_here” with “root” and leave “password_here” blank
  9.  
  10. #ftp
  11.  
  12. #http://www.kometschuh.de/XAMPPFTPConfigurtionMacOSX.html
  13.  
  14. username: daemon
  15. pw: xampp
  16.  
  17.  
  18.  
  19.  
  20. #to work with ftp
  21. chown -R daemon /opt/lampp/htdocs
  22.  
  23.  
  24. #restore from backup
  25. #https://wpremote.com/support-center/getting-started-with-wp-remote/restore-from-backup/
  26.  
  27. siteurl and home values in your wp_options
  28.  
  29. #wordpress
  30.  
  31. cd ~
  32.  
  33. wget https://wordpress.org/latest.tar.gz
  34.  
  35. wget https://downloadsapachefriends.global.ssl.fastly.net/xampp-files/5.6.30/xampp-linux-x64-5.6.30-0-installer.run
  36.  
  37. chmod +x xampp-linux-x64-5.6.30-0-installer.run
  38.  
  39. ./xampp-linux-x64-5.6.30-0-installer.run
  40.  
  41. docker -i -t -p 80:80 centos:centos7 /bin/bash
  42. docker run -i -t -p 80:80 centos:centos7 /bin/bash
  43. docker ps -a
  44. docker rename d29163cda4b5 xampp
  45. docker start xampp
  46. docker ps -a
  47.  
  48. #wordpress "object not found
  49. #http://www.wpbeginner.com/wp-tutorials/how-to-restore-a-wordpress-site-with-just-database-backup/
  50.  
  51. #images are lost
  52. #http://www.inmotionhosting.com/support/edu/wordpress/migrating-wordpress-inmotion-hosting/correct-image-links
  53. wp-posts
  54.  
  55. Go to your dashboard, to settings, and to Permalinks. Restore the permalinks structure to its original state and update. After doing this you should be able to restore it any other state that you like without experiencing problems.
  56.  
  57. UPDATE wp_posts SET post_content=(REPLACE (post_content, '<old url>','<new url>'));
  58.  
  59. nano /etc/hosts
  60.  
  61. 172.0.0.1 thistleknot.ddns.net
  62.  
  63.  
  64.  
  65. #sshd
  66.  
  67. yum remove openssh-server openssh-client -y
  68. yum install openssh-server openssh-client -y
  69. ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
  70. ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
  71. xauth
  72. /usr/sbin/sshd
  73.  
  74. # firefox & error: D-Bus not built with -rdynamic so unable to print a backtrace
  75. #http://www.torkwrench.com/2011/12/16/d-bus-library-appears-to-be-incorrectly-set-up-failed-to-read-machine-uuid-failed-to-open-varlibdbusmachine-id/
  76. dbus-uuidgen > /var/lib/dbus/machine-id
  77.  
  78. #docker network
  79.  
  80. #docker network create --subnet=192.168.3.0/24 3-24
  81.  
  82. #docker run --net 3-24 --expose=8080 --ip 192.168.3.50 -it bd6de9998194 bash
  83.  
  84. #ip route add 192.168.3.0/24 via 192.168.3.1 dev eth0
  85.  
  86. #DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 --bip=192.168.3.1/26"
  87.  
  88. docker run -i -t -p 8080:8080 bd6de9998194 /bin/bash
  89. docker exec 63b1f52c5ecb /opt/tomcat/bin/startup.sh
  90.  
  91. #on host
  92.  
  93. <hostIP>:8080
  94.  
  95. #add route
  96.  
  97. route add 172.17.0.0 MASK 255.0.0.0 172.17.0.1
  98.  
  99. #reverse ssh will not open up ports
  100.  
  101. could add a route? I was able to route to 172.
  102.  
  103. #to install
  104. #general docker info http://www.tecmint.com/install-docker-and-learn-containers-in-centos-rhel-7-6/
  105.  
  106. yum install docker
  107.  
  108. systemctl start docker
  109. systemctl status docker
  110. systemctl enable docker
  111.  
  112. #setup port forwarding in vBox
  113. 2022 to 22
  114.  
  115. #to get up and running
  116.  
  117. docker pull centos:centos7
  118.  
  119. #-i interactive -t run until I tell it to stop
  120.  
  121. #docker run -i -t -p 8080:8080 centos:centos7 yum install -y firefox net-tools ip-route openssh-server openssh-clients xorg-x11-xinit wget java nano NetworkManager NetworkManager-tui unzip
  122.  
  123. docker run -it -d --net=bridge bd6de9998194 /bin/bash
  124.  
  125. docker start <containerName>
  126. docker attach <container> (after starting)
  127. passwd
  128. exit
  129.  
  130. #still running? if not restart
  131. docker ps -a
  132. #docker start <containerId>
  133.  
  134. docker commit <containerId>
  135.  
  136. #rename container
  137. #list containers (check for most recent)
  138. docker ps -a
  139.  
  140. docker rename <containerId> newContainerName
  141.  
  142. #rename image
  143. #list images
  144. docker images
  145. docker tag <imageId> 127.0.0.1:<newName>
  146.  
  147.  
  148. #ssh
  149. docker exec C7v2 /usr/sbin/sshd
  150. docker exec C7v2 ifconfig
  151. docker exec C7v2 /usr/sbin/xauth exit
  152.  
  153. ssh -X [email protected] -p 2022
  154. #Or ssh -X <ip>
  155.  
  156. #tomcat
  157. #https://www.vultr.com/docs/how-to-install-apache-tomcat-8-on-centos-7
  158. wget http://apache.osuosl.org/tomcat/tomcat-8/v8.5.11/bin/apache-tomcat-8.5.11.tar.gz
  159.  
  160. docker start <container>
  161.  
  162. #confirm running, might require
  163.  
  164. #exit
  165.  
  166.  
  167. docker ps -a
  168.  
  169. #send commands
  170. docker exec <container> <command>
  171.  
  172. #bridged network adapter so virtualBox docker image can see router directly. Can use two adapters. one is 172.x (NAT), the other is 192.x
  173.  
  174. #get container id/name
  175. docker ps -l
  176. docker ps -a
  177.  
  178. docker start <container id/name>
  179.  
  180. #inside container
  181. ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
  182.  
  183. docker commit <name>
  184.  
  185. docker ps -a
  186.  
  187. docker rename <container id> <new_name>
  188.  
  189. docker images (see your new image)
  190.  
  191. docker tag <imageID> 127.0.0.1:CentOSwSSH
  192.  
  193. docker rename <container id> <new_name>
  194.  
  195. docker start <name>
  196.  
  197. #has changes
  198. docker attach <name>
  199. docker exec <name> ifconfig
  200.  
  201. #sshd to work
  202. passwd <set root passwd to W3canH3LP!>
  203. /usr/sbin/sshd-keygen -A
  204. #outside of container <commit>
  205.  
  206. docker exec <name> /usr/sbin/sshd
  207.  
  208. #get ip
  209. docker exec <name> ifconfig
  210.  
  211. #run with systemD?, required for sshd to start
  212. #docker run --privileged -ti -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup trinitronx/ansible-base:stable-centos7 /usr/sbin/init
  213.  
  214. #vs ssh
  215. docker exec -ti containername sh
  216.  
  217.  
  218. #x11 forwarding info
  219.  
  220. #on host
  221. yum install -y firefox auth
  222.  
  223. xauth exit
  224.  
  225. ssh -X <hostIP>
  226. ssh -X <dockerIP>
  227.  
  228. #http://stackoverflow.com/questions/25281992/alternatives-to-ssh-x11-forwarding-for-docker-containers
  229. docker run -i -t --rm \
  230. -e DISPLAY=$DISPLAY \
  231.  
  232. #missing -u docker
  233. docker run -i -t --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix/:ro --name="x11" centos:centos7
  234.  
  235. #http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
  236.  
  237. #https://linuxmeerkat.wordpress.com/2014/10/17/running-a-gui-application-in-a-docker-container/
  238.  
  239. #remove all dockers
  240.  
  241. #https://tecadmin.net/remove-docker-images-and-containers/#
  242. #stop & remove all docker containers
  243.  
  244. docker stop $(docker ps -a -q)
  245. docker rm $(docker ps -a -q)
  246.  
  247. # run as service
  248. docker run -d centos:centos7 /bin/yes
  249.  
  250. #remove all images-and-containers/#
  251. docker rmi $(docker images -a -q)
  252.  
  253. #export/import
  254. #https://www.jamescoyle.net/how-to/1512-export-and-import-a-docker-image-between-nodes
  255.  
  256. docker commit 3a09b2588478 mynewimage
  257. docker save mynewimage > /tmp/mynewimage.tar
  258. docker load < /tmp/mynewimage.tar
  259.  
  260. #running systemD
  261. https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/
  262.  
  263.  
  264. #build Dockerfile
  265. mkdir test
  266. cd test
  267. nano Dockerfile
  268.  
  269. FROM centos:centos7
  270. ENV container docker
  271. RUN yum -y update; yum clean all
  272. RUN yum -y install systemd net-tools ip-route firefox xauth; yum clean all;
  273. RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || f $i; done);
  274. RUN rm -f /lib/systemd/system/multi-user.target.wants/*;
  275. RUN rm -f /etc/systemd/system/*.wants/*;
  276. RUN rm -f /lib/systemd/system/local-fs.target.wants/*;
  277. RUN rm -f /lib/systemd/system/sockets.target.wants/*udev*;
  278. RUN rm -f /lib/systemd/system/sockets.target.wants/*initctl*;
  279. RUN rm -f /lib/systemd/system/basic.target.wants/*;
  280. RUN rm -f /lib/systemd/system/anaconda.target.wants/*;
  281. RUN /usr/bin/xauth exit
  282. VOLUME [ “/sys/fs/cgroup” ]
  283. CMD /usr/sbin/init
  284.  
  285.  
  286. #uses current directory /Dockerfile
  287.  
  288. #build own image
  289. #https://docs.docker.com/engine/getstarted/step_four/
  290.  
  291. docker build -t centos:centos7 .
  292.  
  293. #tomcat up on outside ip
  294. #http://stackoverflow.com/questions/6246127/cant-access-tomcat-using-ip-address
  295.  
  296. /conf/server.xml
  297.  
  298.  
  299. <Connector port="8080" protocol="HTTP/1.1"
  300. connectionTimeout="20000"
  301. redirectPort="8443"
  302. useIPVHosts="true"
  303. address="172.17.0.2" />
  304.  
  305.  
  306. #expose port
  307. docker --expose=8080
  308.  
  309. docker run <imagename> -p 8080:8080
  310.  
  311. #port forwarding
  312. docker run -p 8080:3000 my-image
Advertisement
Add Comment
Please, Sign In to add comment